{"id":314140,"date":"2020-12-01T21:00:27","date_gmt":"2020-12-01T21:00:27","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=314140"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=314140","title":{"rendered":"\u0414\u0435\u043b\u0430\u0435\u043c \u043f\u0435\u0447\u0430\u0442\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043a\u043b\u0438\u043a\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e TensorFlow 2 Object Detection API"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/745\/b61\/01a\/745b6101a4bb0c212288c868617942b8.png\" alt=\"Links Detector Cover\"><\/p>\n<p>  <\/p>\n<h2 id=\"tldr\">TL;DR<\/h2>\n<p>  <\/p>\n<p><em>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0430\u0447\u043d\u0435\u043c \u0440\u0435\u0448\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0447\u0430\u0442\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0432 \u043a\u043d\u0438\u0433\u0430\u0445 \u0438\u043b\u0438 \u0436\u0443\u0440\u043d\u0430\u043b\u0430\u0445 \u043a\u043b\u0438\u043a\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u0430\u043c\u0435\u0440\u0443 \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0430.<\/em><\/p>\n<p>  <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/github.com\/tensorflow\/models\/tree\/master\/research\/object_detection\" rel=\"nofollow\">TensorFlow 2 Object Detection API<\/a> \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043c TensorFlow \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438 \u0433\u0430\u0431\u0430\u0440\u0438\u0442\u044b \u0441\u0442\u0440\u043e\u043a <code>https:\/\/<\/code> \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u0430\u0434\u0440\u0435 \u0432\u0438\u0434\u0435\u043e \u0438\u0437 \u043a\u0430\u043c\u0435\u0440\u044b \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0430).<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043a\u0441\u0442 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043f\u043e \u043f\u0440\u0430\u0432\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043e\u0442 <code>https:\/\/<\/code>, \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/tesseract.projectnaptha.com\/\" rel=\"nofollow\">Tesseract<\/a>. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 Tesseract \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u043c \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u043b\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 <a href=\"https:\/\/github.com\/trekhleb\/links-detector\" rel=\"nofollow\">links-detector repository<\/a> \u043d\u0430 GitHub.<\/p>\n<p>  <\/p>\n<blockquote><p><a href=\"https:\/\/trekhleb.github.io\/links-detector\/\" rel=\"nofollow\"><strong>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Links Detector<\/strong><\/a> \u0441\u043e \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p>  <a href=\"https:\/\/github.com\/trekhleb\/links-detector\" rel=\"nofollow\"><strong>\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 links-detector<\/strong><\/a> \u043d\u0430 GitHub \u0441 \u043f\u043e\u043b\u043d\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p><\/blockquote>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u0432 \u0438\u0442\u043e\u0433\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0447\u0430\u0442\u043d\u044b\u0445 \u0441\u0441\u044b\u043b\u043e\u043a:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/trekhleb\/links-detector\/master\/articles\/printed_links_detection\/assets\/03-links-detector-demo.gif\" alt=\"Links Detector Demo\"><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<blockquote><p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <em>\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0439<\/em> \u0441\u0442\u0430\u0434\u0438\u0438 \u0438 \u0438\u043c\u0435\u0435\u0442 <a href=\"https:\/\/github.com\/trekhleb\/links-detector\/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement\" rel=\"nofollow\">\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043e\u043a \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439<\/a>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u043d\u0435\u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043b\u0438\u043a\u0432\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u0439\u0442\u0435 \u043e\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e\u0433\u043e. \u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0446\u0435\u043b\u044c\u044e \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 TensorFlow 2 Object Detection API, \u0430 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 production-ready \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0431\u043b\u043e\u043a\u0438 \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0431\u0435\u0437 \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0438 \u043a\u043e\u0434\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/github.com\/trekhleb\/links-detector\/blob\/master\/articles\/printed_links_detection\/printed_links_detection.ru.md\" rel=\"nofollow\">\u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 GitHub \u0432\u0435\u0440\u0441\u0438\u044e \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/a><\/p><\/blockquote>\n<p>  <\/p>\n<h2 id=\"problema\">\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/h2>\n<p>  <\/p>\n<p>\u042f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c, \u0438 \u0432 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u043e\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0440\u0435\u043c\u044f \u0443\u0447\u0443 Machine Learning \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0445\u043e\u0431\u0431\u0438. \u041d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0435 \u0432 \u044d\u0442\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u042f \u043a\u0443\u043f\u0438\u043b \u043a\u043d\u0438\u0433\u0443 \u043f\u043e \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c\u0443 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e \u0438, \u0447\u0438\u0442\u0430\u044f \u043f\u0435\u0440\u0432\u044b\u0435 \u0433\u043b\u0430\u0432\u044b, \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u0435\u0447\u0430\u0442\u043d\u044b\u0445 \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u043f\u043e\u0434\u043e\u0431\u0438\u0438 <code>https:\/\/tensorflow.org\/<\/code> \u0438\u043b\u0438 <code>https:\/\/some-url.com\/which\/may\/be\/even\/longer?and_with_params=true<\/code>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/0c4\/381\/cbe\/0c4381cbec209c0614c9a8e89dc64425.jpg\" alt=\"Printed Links\"><\/p>\n<p>  <\/p>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043a\u043b\u0438\u043a\u0430\u0442\u044c \u043f\u043e \u043f\u0435\u0447\u0430\u0442\u043d\u044b\u043c \u0441\u0441\u044b\u043b\u043a\u0430\u043c \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u043e\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c (\u0441\u043f\u0430\u0441\u0438\u0431\u043e, \u041a\u044d\u043f!). \u0427\u0442\u043e\u0431\u044b \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043c\u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043d\u0430\u0431\u0438\u0440\u0430\u0442\u044c \u0438\u0445 \u043f\u043e\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0438 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043e\u0442\u043c\u0435\u043d\u044f\u043b.<\/p>\n<p>  <\/p>\n<h2 id=\"vozmozhnoe-reshenie\">\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u042f \u043f\u043e\u0434\u0443\u043c\u0430\u043b, \u0430 \u0447\u0442\u043e \u0435\u0441\u043b\u0438, \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u0435\u043c QR \u043a\u043e\u0434\u043e\u0432, \u043c\u044b &quot;\u043d\u0430\u0443\u0447\u0438\u043c&quot; \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d <em>(1)<\/em> <em>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/em> \u0438 <em>(2)<\/em> <em>\u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c<\/em> \u043f\u0435\u0447\u0430\u0442\u043d\u044b\u0435 \u0433\u0438\u043f\u0435\u0440-\u0441\u0441\u044b\u043b\u043a\u0438 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0445 \u043a\u043b\u0438\u043a\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c\u0438? \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0434\u0435\u043b\u0430\u043b \u0431\u044b \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u043a\u043b\u0438\u043a \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u043e\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430 \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u043d\u0430\u0436\u0430\u0442\u0438\u0439 \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0438. \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0441\u0435\u0439 \u044d\u0442\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u0430\u0441\u044c \u0431\u044b \u0441 <code>O(N)<\/code> \u0434\u043e <code>O(1)<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u0431\u044b \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/trekhleb\/links-detector\/master\/articles\/printed_links_detection\/assets\/03-links-detector-demo.gif\" alt=\"Links Detector Demo\"><\/p>\n<p>  <\/p>\n<h2 id=\"trebovaniya-k-resheniyu\">\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e<\/h2>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u0432\u044b\u0448\u0435, \u044f \u043d\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0442 \u0432 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438. \u0414\u043b\u044f \u043c\u0435\u043d\u044f \u044d\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u0430\u043a \u0445\u043e\u0431\u0431\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438 \u0446\u0435\u043b\u044c \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0432 <em>\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438<\/em> \u0438 <em>\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438<\/em> \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 TensorFlow 2 Object Detection API, \u0447\u0435\u043c \u0432 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f production-ready \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u0421 \u0443\u0447\u0435\u0442\u043e\u043c \u0432\u044b\u0448\u0435\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e, \u044f \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0438 \u0441\u0432\u0435\u043b \u0438\u0445 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043f\u0443\u043d\u043a\u0442\u0430\u043c:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c <strong>\u0431\u043b\u0438\u0437\u043a\u0430<\/strong> \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>0.5-1<\/code> \u043a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0441\u0445\u043e\u0436\u0435\u043c \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441 iPhone X). \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 <em>\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f + \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f<\/em> \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u0437\u0430 <code>2<\/code> \u0441\u0435\u043a\u0443\u043d\u0434\u044b.<\/li>\n<li>\u0414\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 <strong>\u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c<\/strong> \u044f\u0437\u044b\u043a\u0435.<\/li>\n<li>\u0414\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0441\u044b\u043b\u043a\u0438 <strong>\u0447\u0435\u0440\u043d\u043e\u0433\u043e (\u0442\u0435\u043c\u043d\u043e-\u0441\u0435\u0440\u043e\u0433\u043e) \u0446\u0432\u0435\u0442\u0430 \u043d\u0430 \u0431\u0435\u043b\u043e\u043c (\u0441\u0432\u0435\u0442\u043b\u043e-\u0441\u0435\u0440\u043e\u043c) \u0444\u043e\u043d\u0435<\/strong>.<\/li>\n<li>\u0414\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e <code>https:\/\/<\/code> \u0441\u0441\u044b\u043b\u043a\u0438 (\u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e <code>http:\/\/<\/code>, <code>ftp:\/\/<\/code>, <code>tcp:\/\/<\/code> \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u044b).<\/li>\n<\/ol>\n<p>  <\/p>\n<h2 id=\"nahodim-reshenie\">\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<h3 id=\"obschiy-podhod\">\u041e\u0431\u0449\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434<\/h3>\n<p>  <\/p>\n<h4 id=\"variant-1-model-na-storone-servera\">\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u21161: \u041c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h4>\n<p>  <\/p>\n<p><strong>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439:<\/strong><\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0438\u0434\u0435\u043e-\u043f\u043e\u0442\u043e\u043a (\u043a\u0430\u0434\u0440 \u0437\u0430 \u043a\u0430\u0434\u0440\u043e\u043c) \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/li>\n<li>\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u0430\u0434\u0440 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/li>\n<li>\u041e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u043c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0443.<\/li>\n<li>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u0438\u0445 \u043a\u043b\u0438\u043a\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c\u0438.<\/li>\n<\/ol>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b10\/08f\/c41\/b1008fc4187f646645a88963ab5d842e.jpg\" alt=\"Model on the back-end\"><\/p>\n<p>  <\/p>\n<p><strong>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430:<\/strong><\/p>\n<p>  <\/p>\n<ul>\n<li>\u2713 \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u041f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043e\u043a \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u044f \u043d\u0430\u0448\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e (\u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432) \u0438\u043b\u0438 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e (\u0431\u043e\u043b\u044c\u0448\u0435 \u044f\u0434\u0435\u0440 \u0438 GPUs).<\/li>\n<li>\u2713 \u041c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 (\u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c), \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0435\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c <code>~10Mb<\/code> \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u043c, \u043d\u043e \u0432\u0441\u0435-\u0436\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c <code>~100Mb<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u044b\u043c \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e UX (user experience).<\/li>\n<li>\u2713 \u0423 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043c\u043e\u0434\u0435\u043b\u0438. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u043e\u0434\u0435\u043b\u044c &quot;\u0441\u043f\u0440\u044f\u0442\u0430\u043d\u0430&quot; \u0437\u0430 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c API, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430.<\/li>\n<\/ul>\n<p>  <\/p>\n<p><strong>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438:<\/strong><\/p>\n<p>  <\/p>\n<ul>\n<li>\u2717 \u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u0430\u0441\u0442\u0435\u0442. \u0412\u043c\u0435\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043b\u0438\u0448\u044c <code>JavaScript<\/code> \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a \u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>Python<\/code> \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041d\u0430\u043c \u0442\u0430\u043a \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e\u0431 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430.<\/li>\n<li>\u2717 \u0420\u0430\u0431\u043e\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u043e\u0444\u0444\u043b\u0430\u0439\u043d \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0443.<\/li>\n<li>\u2717 \u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u0441\u043b\u0430\u0431\u044b\u043c \u043c\u0435\u0441\u0442\u043e\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043e\u043a \u0441 <code>1<\/code> \u0434\u043e <code>10+<\/code> \u043a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0430\u0442\u044c <code>10+<\/code> \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440. \u0414\u043b\u044f <code>10<\/code> \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u044d\u0442\u043e \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c <code>100+<\/code> \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u041d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0439\u0442\u0438 \u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u0441\u0442\u0440\u0438\u043c\u0438\u043d\u0433 <code>HTTP\/2<\/code> \u0438 <code>gRPC<\/code>, \u043d\u043e \u043c\u044b \u0441\u043d\u043e\u0432\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043f\u0443\u043d\u043a\u0442\u0443, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0441 \u0440\u0430\u0441\u0442\u0443\u0449\u0435\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/li>\n<li>\u2717 \u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u0430\u0441\u0442\u0435\u0442. \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u043e\u043f\u043b\u0430\u0442\u043e\u0439 \u0437\u0430 \u0430\u0440\u0435\u043d\u0434\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432.<\/li>\n<\/ul>\n<p>  <\/p>\n<h4 id=\"variant-2-model-na-storone-klienta\">\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u21162: \u041c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/h4>\n<p>  <\/p>\n<p><strong>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439:<\/strong><\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0438\u0434\u0435\u043e-\u043f\u043e\u0442\u043e\u043a (\u043a\u0430\u0434\u0440 \u0437\u0430 \u043a\u0430\u0434\u0440\u043e\u043c) \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/li>\n<li>\u041e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u043c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 (\u0431\u0435\u0437 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440).<\/li>\n<li>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u0438\u0445 \u043a\u043b\u0438\u043a\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c\u0438.<\/li>\n<\/ol>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9d3\/5d5\/1a8\/9d35d51a8edae4727238f9dc487ab5e1.jpg\" alt=\"Model on the front-end\"><\/p>\n<p>  <\/p>\n<p><strong>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430:<\/strong><\/p>\n<p>  <\/p>\n<ul>\n<li>\u2713 \u041c\u0435\u043d\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430. \u041d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f API.<\/li>\n<li>\u2713 \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u043e\u0444\u0444\u043b\u0430\u0439\u043d. \u041c\u043e\u0434\u0435\u043b\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043a \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0443 (\u0441\u043c. <a href=\"https:\/\/web.dev\/progressive-web-apps\/\" rel=\"nofollow\">Progressive Web Application<\/a>)<\/li>\n<li>\u2713 \u0421\u0438\u0441\u0442\u0435\u043c\u0430 &quot;\u043f\u043e\u0447\u0442\u0438&quot; \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u0430. \u041a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f &quot;\u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442&quot; \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u043c \u0438 \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0440\u0442\u043e\u0439. \u042d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u043d\u0435\u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (\u043c\u044b \u0437\u0430\u0442\u0440\u043e\u043d\u0435\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u043d\u0438\u0436\u0435).<\/li>\n<li>\u2713 \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0434\u0435\u0448\u0435\u0432\u043b\u0435. \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u043b\u0430\u0442\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 (<code>HTML<\/code>, <code>JS<\/code>, <code>CSS<\/code>, \u0444\u0430\u0439\u043b\u044b \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043f\u0440.). \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 GitHub, \u0442\u0430\u043a\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e.<\/li>\n<li>\u2713 \u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 (\u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u044b) \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c.<\/li>\n<\/ul>\n<p>  <\/p>\n<p><strong>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438:<\/strong><\/p>\n<p>  <\/p>\n<ul>\n<li>\u2717 \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043a\u043e\u0433\u0434\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b \u0438 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043a\u0430\u0440\u0442\u0443. \u0412\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043e\u043a \u0434\u043b\u044f \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432.<\/li>\n<li>\u2717 \u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043a \u0441\u0435\u0431\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u0433\u0434\u0435 \u0438 \u043a\u0430\u043a \u0443\u0433\u043e\u0434\u043d\u043e.<\/li>\n<li>\u2717 \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u0445\u043e\u0434\u0430 \u0431\u0430\u0442\u0430\u0440\u0435\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439. \u041c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u044b \u0442\u0435\u043c, \u0447\u0442\u043e \u0438\u0445 iPhone \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u0442\u0435\u043f\u043b\u0435\u0435 \u0438 \u0442\u0435\u043f\u043b\u0435\u0435 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b.<\/li>\n<\/ul>\n<p>  <\/p>\n<h4 id=\"vybiraem-obschiy-podhod\">\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043e\u0431\u0449\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434<\/h4>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0446\u0435\u043b\u044e \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 \u0446\u0435\u043b\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435, \u0430 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f <em>\u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/em>. \u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u043c\u0435\u043d\u0435\u0435 \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u044b\u043c \u0438 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0444\u043e\u043a\u0443\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438, \u0430 \u043d\u0435 \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b.<\/p>\n<p>  <\/p>\n<h3 id=\"uglublyaemsya-v-detali\">\u0423\u0433\u043b\u0443\u0431\u043b\u044f\u0435\u043c\u0441\u044f \u0432 \u0434\u0435\u0442\u0430\u043b\u0438<\/h3>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0435\u0437 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0442\u0435\u043f\u0435\u0440\u044c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0435\u0441\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 (\u043a\u0430\u0434\u0440) \u0438\u0437 \u0432\u0438\u0434\u0435\u043e-\u043f\u043e\u0442\u043e\u043a\u0430 \u043a\u0430\u043c\u0435\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ad6\/a43\/349\/ad6a433499d46bf50b63d69734154c37.jpg\" alt=\"Printed Links Input\"><\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u0434\u0432\u0435 \u043f\u043e\u0434\u0437\u0430\u0434\u0430\u0447\u0438:<\/p>\n<p>  <\/p>\n<ol>\n<li><strong>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435<\/strong> \u0441\u0441\u044b\u043b\u043e\u043a (\u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438 \u0433\u0430\u0431\u0430\u0440\u0438\u0442\u044b \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435)<\/li>\n<li><strong>\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435<\/strong> \u0441\u0441\u044b\u043b\u043e\u043a (\u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0441\u0441\u044b\u043b\u043e\u043a)<\/li>\n<\/ol>\n<p>  <\/p>\n<h4 id=\"variant-1-reshenie-na-osnove-biblioteki-tesseract\">\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u21161: \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Tesseract<\/h4>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0438 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u0434\u0430\u0447\u0438 <em>\u043e\u043f\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432<\/em> (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Optical_character_recognition\" rel=\"nofollow\">OCR<\/a>) \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u0432\u0441\u0435\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/github.com\/naptha\/tesseract.js\" rel=\"nofollow\">Tesseract.js<\/a>. \u041e\u043d\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0438 \u0432\u044b\u0434\u0430\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u0433\u0440\u0430\u0444\u044b, \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u0431\u043b\u043e\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u0441\u043b\u043e\u0432\u0430 \u0438 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0433\u0430\u0431\u0430\u0440\u0438\u0442\u0430\u043c\u0438 \u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a2b\/208\/44e\/a2b20844e61c8aff72a78bd9777f23ce.jpg\" alt=\"Recognized text with bounding boxes\"><\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0441\u0441\u044b\u043b\u043a\u0438 \u0432 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f <a href=\"https:\/\/stackoverflow.com\/questions\/3809401\/what-is-a-good-regular-expression-to-match-a-url\" rel=\"nofollow\">\u043f\u043e\u0445\u043e\u0436\u0435\u0433\u043e \u043d\u0430 \u044d\u0442\u043e<\/a> (\u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 TypeScript):<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">const URL_REG_EXP = \/https?:\\\/\\\/(www\\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\\.[a-z]{2,4}\\b([-a-zA-Z0-9@:%_+.~#?&amp;\/=]*)\/gi;  const extractLinkFromText = (text: string): string | null =&gt; {   const urls: string[] | null = text.match(URL_REG_EXP);   if (!urls || !urls.length) {     return null;   }   return urls[0]; };<\/code><\/pre>\n<p>  <\/p>\n<p>\u2713 \u041f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0448\u0435\u043d\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u044f\u043c\u043e\u043b\u0438\u043d\u0435\u0439\u043d\u044b\u043c \u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041c\u044b \u0437\u043d\u0430\u0435\u043c \u0433\u0430\u0431\u0430\u0440\u0438\u0442\u044b \u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0441\u0441\u044b\u043b\u043e\u043a.<\/li>\n<li>\u041c\u044b \u0442\u0430\u043a \u0436\u0435 \u0437\u043d\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0441\u0441\u044b\u043b\u043e\u043a \u0438 \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0445 \u043a\u043b\u0438\u043a\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c\u0438.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u2717 \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0440\u0435\u043c\u044f <em>\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f + \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f<\/em> \u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u0440\u044c\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 <code>2<\/code> \u0434\u043e <code>20+<\/code> \u0441\u0435\u043a\u0443\u043d\u0434 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0435\u0433\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0438 &quot;\u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u043d\u0430 \u0442\u0435\u043a\u0441\u0442&quot; \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0442\u043e\u0439 <em>\u0431\u043b\u0438\u0437\u043a\u043e\u0439<\/em> \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 <code>0.5-1<\/code> \u043a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.<\/p>\n<p>  <\/p>\n<p>\u2717 \u0422\u0430\u043a\u0436\u0435, \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0442\u043e \u043c\u044b \u043f\u0440\u043e\u0441\u0438\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c <strong>\u0432\u0435\u0441\u044c<\/strong> \u0442\u0435\u043a\u0441\u0442 \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0442 \u0441\u0441\u044b\u043b\u043e\u043a \u0438\u043b\u0438 \u0435\u0441\u043b\u0438 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430-\u0434\u0432\u0435 \u0441\u0441\u044b\u043b\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442, \u043f\u0443\u0441\u043a\u0430\u0439, ~10% \u043e\u0442 \u0432\u0441\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043c\u0430 \u0442\u0435\u043a\u0441\u0442\u0430. \u042d\u0442\u043e \u0437\u0432\u0443\u0447\u0438\u0442 \u043a\u0430\u043a \u043d\u0435\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0442\u0440\u0430\u0442\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.<\/p>\n<p>  <\/p>\n<h4 id=\"variant-2-reshenie-na-osnove-bibliotek-tesseract-i-tensorflow-1-model\">\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u21162: \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a Tesseract \u0438 TensorFlow (+1 \u043c\u043e\u0434\u0435\u043b\u044c)<\/h4>\n<p>  <\/p>\n<p>\u041c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c Tesseract \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0435\u0449\u0435 \u043e\u0434\u0438\u043d <em>\u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 &quot;\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c-\u0441\u043e\u0432\u0435\u0442\u0447\u0438\u043a&quot;<\/em> \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044e \u0441\u0441\u044b\u043b\u043e\u043a. \u042d\u0442\u043e\u0442 &quot;\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c-\u0441\u043e\u0432\u0435\u0442\u0447\u0438\u043a&quot; \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c (\u043d\u043e \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c) <em>\u043d\u0430\u0447\u0430\u043b\u043e \u0441\u0441\u044b\u043b\u043e\u043a (\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0441\u0430\u043c\u043e\u0439 \u043b\u0435\u0432\u043e\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u0441\u044b\u043b\u043a\u0438)<\/em> \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438 \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u0441\u044b\u043b\u043e\u043a, \u0435\u0441\u043b\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0415\u0441\u043b\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 Tesseract.<\/li>\n<li>\u0415\u0441\u043b\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0441\u044b\u043b\u043a\u0438, \u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b &quot;\u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c&quot; Tesseract \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0447\u0430\u0441\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0442\u0435\u043a\u0441\u0442 \u0441\u0441\u044b\u043b\u043e\u043a. \u041c\u044b \u0445\u043e\u0442\u0438\u043c \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 &quot;\u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e&quot; \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0442\u0435\u043a\u0441\u0442\u0430.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 &quot;\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c-\u0441\u043e\u0432\u0435\u0442\u0447\u0438\u043a&quot;, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0437\u043e\u0432\u043e\u043c Tesseract \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0437\u0430 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f, \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u044b\u043c \u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0441\u0441\u044b\u043b\u043e\u043a \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0447\u0435\u043c \u0437\u0430 <code>1<\/code> \u0441\u0435\u043a\u0443\u043d\u0434\u0443 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 iPhone X). \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0431\u043b\u0438\u0437\u043a\u043e\u043c \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f &quot;\u0431\u043b\u0438\u0437\u043e\u0441\u0442\u0438&quot; \u043c\u044b \u0434\u0430\u043b\u0438 \u0432\u044b\u0448\u0435). <\/p>\n<p>  <\/p>\n<blockquote><p>\u0418\u0442\u0430\u043a, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0435\u0449\u0435 \u043e\u0434\u043d\u0438\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c (\u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e) \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u043d\u0430\u0439\u0442\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 <code>https:\/\/<\/code> \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 (\u043a\u0430\u0436\u0434\u0430\u044f \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 <code>https:\/\/<\/code>, \u043d\u0435 \u0442\u0430\u043a \u043b\u0438?). \u0422\u043e\u0433\u0434\u0430, \u0437\u043d\u0430\u044f \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0433\u0430\u0431\u0430\u0440\u0438\u0442\u044b \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u0432 <code>https:\/\/<\/code> \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438, \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Tesseract \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0447\u0430\u0441\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043f\u043e \u043f\u0440\u0430\u0432\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043e\u0442 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u0432 <code>https:\/\/<\/code> \u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u0445 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c.<\/p><\/blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0438\u0436\u0435:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6ef\/7e4\/72a\/6ef7e472afd39bfe0d1b7508449d6144.jpg\" alt=\"Tesseract and TensorFlow based solution\"><\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e Tesseract \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c <strong>\u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043c\u0435\u043d\u044c\u0448\u0435<\/strong> \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044e \u0442\u0435\u043a\u0441\u0442\u0430, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0435\u043c \u0435\u043c\u0443, \u0433\u0434\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0438 (\u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u043e\u043b\u0443\u0431\u044b\u0445 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432, \u0447\u0435\u043c \u043d\u0435 \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e). <\/p>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u0432\u043e\u043f\u0440\u043e\u0441, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u0430\u043a\u0443\u044e \u0436\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0438 \u043a\u0430\u043a &quot;\u043d\u0430\u0443\u0447\u0438\u0442\u044c&quot; \u0435\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u044b <code>https:\/\/<\/code>.<\/p>\n<p>  <\/p>\n<blockquote><p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043c\u044b \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0431\u043b\u0438\u0436\u0435 \u043a TensorFlow<\/p><\/blockquote>\n<p>  <\/p>\n<h2 id=\"vybiraem-podhodyaschuyu-model-obnaruzheniya-obektov\">\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/h2>\n<p>  <\/p>\n<p>\u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430 \u043d\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u043d\u0443\u043b\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u2717 \u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u0434\u043d\u0438\/\u043d\u0435\u0434\u0435\u043b\u0438 \u0438 \u0441\u0442\u043e\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0434\u0435\u043d\u0435\u0433 (\u0437\u0430 \u0430\u0440\u0435\u043d\u0434\u0443 \u0442\u0435\u0445-\u0436\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0441 GPU).<\/li>\n<li>\u2717 \u0423 \u043d\u0430\u0441 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u0441\u043e\u0442\u0435\u043d \u0442\u044b\u0441\u044f\u0447 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439 \u043a\u043d\u0438\u0433 \u0438 \u0436\u0443\u0440\u043d\u0430\u043b\u043e\u0432 \u0441\u043e \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438. \u0422\u0435\u043c-\u0431\u043e\u043b\u0435\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043d\u043e \u0435\u0449\u0435 \u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u0432 <code>https:\/\/<\/code> \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0438\u0436\u0435.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u0443\u0447\u0430\u0442\u044c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0438 \u043d\u0430\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0434\u043b\u044f \u043d\u0435\u0435 \u043a\u043b\u0430\u0441\u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u0441\u043c. <a href=\"https:\/\/en.wikipedia.org\/wiki\/Transfer_learning\" rel=\"nofollow\">transfer learning<\/a>). \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0434 &quot;\u043d\u043e\u0432\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c&quot; \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0432 \u0432\u0438\u0434\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430 <code>https:\/\/<\/code>. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u2713 \u041d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043c\u0435\u043d\u044c\u0448\u0438\u043c. \u041d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u043e\u0442\u043d\u0438 \u0442\u044b\u0441\u044f\u0447 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0441 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438 (\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438). \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0441\u043e\u0442\u043d\u0435\u0439 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432\u0440\u0443\u0447\u043d\u0443\u044e. \u042d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e \u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u0443\u0436\u0435 \u043d\u0430\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430 \u043d\u0430 \u043e\u0431\u0449\u0435\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u0430 <a href=\"https:\/\/cocodataset.org\/#home\" rel=\"nofollow\">COCO<\/a> \u0438 \u0443\u0436\u0435 \u0443\u043c\u0435\u0435\u0442 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (\u043d\u0430\u0443\u0447\u0438\u0442\u044c &quot;\u043f\u0435\u0440\u0432\u043e\u043a\u0443\u0440\u0441\u043d\u0438\u043a\u0430&quot; \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0430\u043b\u0433\u0435\u0431\u0440\u0435, <em>\u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e<\/em>, \u043b\u0435\u0433\u0447\u0435, \u0447\u0435\u043c &quot;\u043f\u0435\u0440\u0432\u043e\u043a\u043b\u0430\u0441\u0441\u043d\u0438\u043a\u0430&quot;).<\/li>\n<li>\u2713 \u0412\u0440\u0435\u043c\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u0442\u0430\u043a \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043c\u0435\u043d\u044c\u0448\u0438\u043c (\u043d\u0430 GPU \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043c\u0438\u043d\u0443\u0442\u044b\/\u0447\u0430\u0441\u044b \u0432\u043c\u0435\u0441\u0442\u043e \u0434\u043d\u0435\u0439\/\u043d\u0435\u0434\u0435\u043b\u044c). \u0412\u0440\u0435\u043c\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u0441\u0447\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043f\u0430\u0440\u0442\u0438\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438) \u0438 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0438\u0437 <a href=\"https:\/\/github.com\/tensorflow\/models\/blob\/master\/research\/object_detection\/g3doc\/tf2_detection_zoo.md\" rel=\"nofollow\">&quot;\u0437\u043e\u043e\u043f\u0430\u0440\u043a\u0430&quot; \u043c\u043e\u0434\u0435\u043b\u0435\u0439 TensorFlow 2<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0430\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 <a href=\"https:\/\/cocodataset.org\/#home\" rel=\"nofollow\">COCO 2017<\/a>. \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u044d\u0442\u0430 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f <code>~40<\/code> \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0439 \u043c\u043e\u0434\u0435\u043b\u0435\u0439.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b &quot;\u043d\u0430\u0443\u0447\u0438\u0442\u044c&quot; \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435, \u0440\u0430\u043d\u0435\u0435 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <a href=\"https:\/\/github.com\/tensorflow\/models\/tree\/master\/research\/object_detection\" rel=\"nofollow\">TensorFlow 2 Object Detection API<\/a>. TensorFlow Object Detection API \u2014 \u044d\u0442\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <a href=\"https:\/\/www.tensorflow.org\/\" rel=\"nofollow\">TensorFlow<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u0442\u0435 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u043d\u0430 <a href=\"https:\/\/github.com\/tensorflow\/models\/blob\/master\/research\/object_detection\/g3doc\/tf2_detection_zoo.md\" rel=\"nofollow\">&quot;\u0437\u043e\u043e\u043f\u0430\u0440\u043a&quot; \u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/a> \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0442\u0430\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u0430 <em>\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c<\/em> \u0438 <em>\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c<\/em> \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f01\/df6\/492\/f01df6492b87597aa9333c853eaa333b.jpg\" alt=\"Model Zoo\"><\/p>\n<p>  <\/p>\n<p>_\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u0437\u044f\u0442\u043e \u0441 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f <a href=\"https:\/\/github.com\/tensorflow\/models\/blob\/master\/research\/object_detection\/g3doc\/tf2_detection_zoo.md\" rel=\"nofollow\">TensorFlow Model Zoo<\/a>_<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c, \u043d\u0430\u043c \u0432\u0430\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 <strong>\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e<\/strong> \u0438 <strong>\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e<\/strong> \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f. \u041d\u043e \u0447\u0442\u043e \u0435\u0449\u0435 \u0432\u0430\u0436\u043d\u0435\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u044d\u0442\u043e <strong>\u0440\u0430\u0437\u043c\u0435\u0440<\/strong> \u043c\u043e\u0434\u0435\u043b\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0435\u0435 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u043c\u0435\u0440 \u0430\u0440\u0445\u0438\u0432\u0430 \u0441 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u0440\u044c\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 <code>~20Mb<\/code> \u0434\u043e <code>~1Gb<\/code>. \u0412\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432:<\/p>\n<p>  <\/p>\n<ul>\n<li><code>1386 (Mb)<\/code> <code>centernet_hg104_1024x1024_kpts_coco17_tpu-32<\/code><\/li>\n<li><code>330 (Mb)<\/code> <code>centernet_resnet101_v1_fpn_512x512_coco17_tpu-8<\/code><\/li>\n<li><code>195 (Mb)<\/code> <code>centernet_resnet50_v1_fpn_512x512_coco17_tpu-8<\/code><\/li>\n<li><code>198 (Mb)<\/code> <code>centernet_resnet50_v1_fpn_512x512_kpts_coco17_tpu-8<\/code><\/li>\n<li><code>227 (Mb)<\/code> <code>centernet_resnet50_v2_512x512_coco17_tpu-8<\/code><\/li>\n<li><code>230 (Mb)<\/code> <code>centernet_resnet50_v2_512x512_kpts_coco17_tpu-8<\/code><\/li>\n<li><code>29 (Mb)<\/code> <code>efficientdet_d0_coco17_tpu-32<\/code><\/li>\n<li><code>49 (Mb)<\/code> <code>efficientdet_d1_coco17_tpu-32<\/code><\/li>\n<li><code>60 (Mb)<\/code> <code>efficientdet_d2_coco17_tpu-32<\/code><\/li>\n<li><code>89 (Mb)<\/code> <code>efficientdet_d3_coco17_tpu-32<\/code><\/li>\n<li><code>151 (Mb)<\/code> <code>efficientdet_d4_coco17_tpu-32<\/code><\/li>\n<li><code>244 (Mb)<\/code> <code>efficientdet_d5_coco17_tpu-32<\/code><\/li>\n<li><code>376 (Mb)<\/code> <code>efficientdet_d6_coco17_tpu-32<\/code><\/li>\n<li><code>376 (Mb)<\/code> <code>efficientdet_d7_coco17_tpu-32<\/code><\/li>\n<li><code>665 (Mb)<\/code> <code>extremenet<\/code><\/li>\n<li><code>427 (Mb)<\/code> <code>faster_rcnn_inception_resnet_v2_1024x1024_coco17_tpu-8<\/code><\/li>\n<li><code>424 (Mb)<\/code> <code>faster_rcnn_inception_resnet_v2_640x640_coco17_tpu-8<\/code><\/li>\n<li><code>337 (Mb)<\/code> <code>faster_rcnn_resnet101_v1_1024x1024_coco17_tpu-8<\/code><\/li>\n<li><code>337 (Mb)<\/code> <code>faster_rcnn_resnet101_v1_640x640_coco17_tpu-8<\/code><\/li>\n<li><code>343 (Mb)<\/code> <code>faster_rcnn_resnet101_v1_800x1333_coco17_gpu-8<\/code><\/li>\n<li><code>449 (Mb)<\/code> <code>faster_rcnn_resnet152_v1_1024x1024_coco17_tpu-8<\/code><\/li>\n<li><code>449 (Mb)<\/code> <code>faster_rcnn_resnet152_v1_640x640_coco17_tpu-8<\/code><\/li>\n<li><code>454 (Mb)<\/code> <code>faster_rcnn_resnet152_v1_800x1333_coco17_gpu-8<\/code><\/li>\n<li><code>202 (Mb)<\/code> <code>faster_rcnn_resnet50_v1_1024x1024_coco17_tpu-8<\/code><\/li>\n<li><code>202 (Mb)<\/code> <code>faster_rcnn_resnet50_v1_640x640_coco17_tpu-8<\/code><\/li>\n<li><code>207 (Mb)<\/code> <code>faster_rcnn_resnet50_v1_800x1333_coco17_gpu-8<\/code><\/li>\n<li><code>462 (Mb)<\/code> <code>mask_rcnn_inception_resnet_v2_1024x1024_coco17_gpu-8<\/code><\/li>\n<li><code>86 (Mb)<\/code> <code>ssd_mobilenet_v1_fpn_640x640_coco17_tpu-8<\/code><\/li>\n<li><code>44 (Mb)<\/code> <code>ssd_mobilenet_v2_320x320_coco17_tpu-8<\/code><\/li>\n<li><code>20 (Mb)<\/code> <code>ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8<\/code><\/li>\n<li><code>20 (Mb)<\/code> <code>ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8<\/code><\/li>\n<li><code>369 (Mb)<\/code> <code>ssd_resnet101_v1_fpn_1024x1024_coco17_tpu-8<\/code><\/li>\n<li><code>369 (Mb)<\/code> <code>ssd_resnet101_v1_fpn_640x640_coco17_tpu-8<\/code><\/li>\n<li><code>481 (Mb)<\/code> <code>ssd_resnet152_v1_fpn_1024x1024_coco17_tpu-8<\/code><\/li>\n<li><code>480 (Mb)<\/code> <code>ssd_resnet152_v1_fpn_640x640_coco17_tpu-8<\/code><\/li>\n<li><code>233 (Mb)<\/code> <code>ssd_resnet50_v1_fpn_1024x1024_coco17_tpu-8<\/code><\/li>\n<li><code>233 (Mb)<\/code> <code>ssd_resnet50_v1_fpn_640x640_coco17_tpu-8<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c <strong><code>ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8<\/code><\/strong> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u2713 \u041e\u043d\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u2014 <code>20Mb<\/code> \u0432 \u0430\u0440\u0445\u0438\u0432\u0435.<\/li>\n<li>\u2713 \u041e\u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0430\u044f \u2014 <code>39ms<\/code> \u043d\u0430 \u043e\u0434\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435.<\/li>\n<li>\u2713 \u041e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0435\u0442\u044c MobileNet v2 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u044d\u043a\u0441\u0442\u0440\u0430\u043a\u0442\u043e\u0440\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (feature extractor), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043f\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0438\u0439 \u0440\u0430\u0441\u0445\u043e\u0434 \u0431\u0430\u0442\u0430\u0440\u0435\u0438.<\/li>\n<li>\u2713 \u041e\u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 <strong>\u0437\u0430 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0445\u043e\u0434<\/strong> \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (\u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0448\u0430\u0433 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Region_Based_Convolutional_Neural_Networks\" rel=\"nofollow\">regions proposal<\/a>, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u0435\u0442\u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435).<\/li>\n<li>\u2717 \u0412 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u044d\u0442\u043e \u043d\u0435 \u0441\u0430\u043c\u0430\u044f \u0442\u043e\u0447\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c (\u0432\u0441\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0438\u0441\u0441\u043e\u043c \ufe0f)<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0435\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u044b \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0435\u0435:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u2014 <code>640x640px<\/code>.<\/li>\n<li>\u041c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <a href=\"https:\/\/arxiv.org\/abs\/1512.02325\" rel=\"nofollow\">Single Shot MultiBox Detector<\/a> (SSD) \u0438 <a href=\"https:\/\/arxiv.org\/abs\/1612.03144\" rel=\"nofollow\">Feature Pyramid Network<\/a> (FPN).<\/li>\n<li>\u0421\u0432\u0435\u0440\u0442\u043e\u0447\u043d\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Convolutional_neural_network\" rel=\"nofollow\">CNN<\/a>) <a href=\"https:\/\/ai.googleblog.com\/2018\/04\/mobilenetv2-next-generation-of-on.html\" rel=\"nofollow\">MobileNet v2<\/a> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u044d\u043a\u0441\u0442\u0440\u0430\u043a\u0442\u043e\u0440\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (feature extractor).<\/li>\n<li>\u041c\u043e\u0434\u0435\u043b\u044c \u0431\u044b\u043b\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0430 \u043d\u0430 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 <a href=\"https:\/\/cocodataset.org\/#home\" rel=\"nofollow\">COCO<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"ustanavlivaem-object-detection-api\">\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Object Detection API<\/h2>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c Tensorflow 2 Object Detection API <em>\u0432 \u0432\u0438\u0434\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 Python<\/em>. \u042d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u043e, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0435 \u0432 <a href=\"https:\/\/colab.research.google.com\/\" rel=\"nofollow\">Google Colab<\/a> (\u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u043e) \u0438\u043b\u0438 \u0432 <a href=\"https:\/\/jupyter.org\/try\" rel=\"nofollow\">Jupyter<\/a>. \u0412 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0438 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 Object Detection API \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Docker, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 <a href=\"https:\/\/github.com\/tensorflow\/models\/blob\/master\/research\/object_detection\/g3doc\/tf2.md\" rel=\"nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<p>  <\/p>\n<blockquote><p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 API \u0438\u043b\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u044b), \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/tensorflow-object-detection-api-tutorial.readthedocs.io\/en\/latest\/index.html\" rel=\"nofollow\">TensorFlow 2 Object Detection API tutorial<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u0438 \u0441\u043e\u0432\u0435\u0442\u043e\u0432.<\/p><\/blockquote>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c <a href=\"https:\/\/github.com\/tensorflow\/models\" rel=\"nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 API<\/a>:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">git clone --depth 1 https:\/\/github.com\/tensorflow\/models<\/code><\/pre>\n<p>  <\/p>\n<p><em>output \u2192<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Cloning into 'models'... remote: Enumerating objects: 2301, done. remote: Counting objects: 100% (2301\/2301), done. remote: Compressing objects: 100% (2000\/2000), done. remote: Total 2301 (delta 561), reused 922 (delta 278), pack-reused 0 Receiving objects: 100% (2301\/2301), 30.60 MiB | 13.90 MiB\/s, done. Resolving deltas: 100% (561\/561), done.<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u0435\u043c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/tensorflow\/models\/tree\/master\/research\/object_detection\/protos\" rel=\"nofollow\">\u0444\u0430\u0439\u043b\u044b-\u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u044b API<\/a> \u0432 Python \u0444\u043e\u0440\u043c\u0430\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <a href=\"https:\/\/grpc.io\/docs\/protoc-installation\/\" rel=\"nofollow\">protoc<\/a>:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">cd .\/models\/research protoc object_detection\/protos\/*.proto --python_out=.<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 API \u0434\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0438 TensorFlow 2 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <code>pip<\/code> \u0438 \u0444\u0430\u0439\u043b <a href=\"https:\/\/github.com\/tensorflow\/models\/blob\/master\/research\/object_detection\/packages\/tf2\/setup.py\" rel=\"nofollow\">setup.py<\/a>`:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">cp .\/object_detection\/packages\/tf2\/setup.py . pip install . --quiet<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>\u0415\u0441\u043b\u0438 \u043d\u0430 \u044d\u0442\u043e\u043c \u0448\u0430\u0433\u0435 \u0432\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <code>pip install . --quiet<\/code> \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0437.<\/p><\/blockquote>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u0442\u0435\u0441\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">python object_detection\/builders\/model_builder_tf2_test.py<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">[       OK ] ModelBuilderTF2Test.test_unknown_ssd_feature_extractor ---------------------------------------------------------------------- Ran 20 tests in 45.072s  OK (skipped=1)<\/code><\/pre>\n<p>  <\/p>\n<p>TensorFlow Object Detection API \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430! \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b \u044d\u0442\u043e\u0439 API, \u0434\u043b\u044f <a href=\"https:\/\/github.com\/tensorflow\/models\/blob\/master\/research\/object_detection\/colab_tutorials\/inference_tf2_colab.ipynb\" rel=\"nofollow\">\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445<\/a>, <a href=\"https:\/\/github.com\/tensorflow\/models\/blob\/master\/research\/object_detection\/g3doc\/tf2_training_and_evaluation.md\" rel=\"nofollow\">\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/github.com\/tensorflow\/models\/blob\/master\/research\/object_detection\/colab_tutorials\/eager_few_shot_od_training_tf2_colab.ipynb\" rel=\"nofollow\">\u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/a> \u043c\u043e\u0434\u0435\u043b\u0435\u0439.<\/p>\n<p>  <\/p>\n<h2 id=\"zagruzhaem-zaranee-obuchennuyu-model\">\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c<\/h2>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0440\u0430\u043d\u0435\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u043d\u0430\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u044c <code>ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8<\/code> \u0438\u0437 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 TensorFlow \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u0449\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a &quot;\u043a\u043e\u0442&quot;, &quot;\u0441\u043e\u0431\u0430\u043a\u0430&quot;, &quot;\u043c\u0430\u0448\u0438\u043d\u0430&quot; \u0438 \u043f\u0440. (\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u043c\u0438 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 COCO). <\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u043e\u0439 TensorFlow <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/utils\/get_file\" rel=\"nofollow\">get_file()<\/a> \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e URL \u0438 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0435\u0435 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u043a\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import tensorflow as tf import pathlib  MODEL_NAME = 'ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8' TF_MODELS_BASE_PATH = 'http:\/\/download.tensorflow.org\/models\/object_detection\/tf2\/20200711\/' CACHE_FOLDER = '.\/cache'  def download_tf_model(model_name, cache_folder):     model_url = TF_MODELS_BASE_PATH + model_name + '.tar.gz'     model_dir = tf.keras.utils.get_file(         fname=model_name,          origin=model_url,         untar=True,         cache_dir=pathlib.Path(cache_folder).absolute()     )     return model_dir  # Start the model download. model_dir = download_tf_model(MODEL_NAME, CACHE_FOLDER) print(model_dir)<\/code><\/pre>\n<p>  <\/p>\n<p><em>output \u2192<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">\/content\/cache\/datasets\/ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0430\u043f\u043e\u043a:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ba6\/e6a\/ef4\/ba6e6aef4124664efef1f1af4f1f9c95.jpg\" alt=\"Cache Folder\"><\/p>\n<p>  <\/p>\n<p>\u041f\u0430\u043f\u043a\u0430 <code>checkpoint<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 &quot;\u0441\u043b\u0435\u043f\u043e\u043a&quot; \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<p>\u0424\u0430\u0439\u043b <code>pipeline.config<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f. \u041c\u044b \u0435\u0449\u0435 \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u044d\u0442\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 \u043d\u0438\u0436\u0435, \u043a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u0443\u0447\u0430\u0442\u044c \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c.<\/p>\n<p>  <\/p>\n<h2 id=\"obnaruzhenie-obektov-s-pomoschyu-zagruzhennoy-modeli\">\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438<\/h2>\n<p>  <\/p>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 COCO (<a href=\"https:\/\/cocodataset.org\/#explore\" rel=\"nofollow\">\u0438\u0445 \u0432\u0441\u0435\u0433\u043e 90<\/a>), \u0442\u0430\u043a\u0438\u0445, \u043a\u0430\u043a <code>car<\/code>, <code>bird<\/code>, <code>hot dog<\/code> \u0438 \u043f\u0440. \u042d\u0442\u0438 \u043a\u043b\u0430\u0441\u0441\u044b \u0435\u0449\u0435 \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u044f\u0440\u043b\u044b\u043a\u0430\u043c\u0438 (labels).<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/43e\/daa\/fc7\/43edaafc7d30b56f3421efff4cac6d42.jpg\" alt=\"COCO classes\"><\/p>\n<p>  <\/p>\n<p><em>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f: <a href=\"https:\/\/cocodataset.org\/#explore\" rel=\"nofollow\">\u0441\u0430\u0439\u0442 COCO<\/a><\/em><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442 \u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u044d\u0442\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<\/p>\n<p>  <\/p>\n<h3 id=\"zagruzhaem-yarlyki-coco\">\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u044f\u0440\u043b\u044b\u043a\u0438 COCO<\/h3>\n<p>  <\/p>\n<p>Object Detection API \u0443\u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0444\u0430\u0439\u043b \u0441 \u043f\u043e\u043b\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 (\u044f\u0440\u043b\u044b\u043a\u043e\u0432) COCO \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430. <\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import os  # Import Object Detection API helpers. from object_detection.utils import label_map_util  # Loads the COCO labels data (class names and indices relations). def load_coco_labels():     # Object Detection API already has a complete set of COCO classes defined for us.     label_map_path = os.path.join(         'models\/research\/object_detection\/data',         'mscoco_complete_label_map.pbtxt'     )     label_map = label_map_util.load_labelmap(label_map_path)      # Class ID to Class Name mapping.     categories = label_map_util.convert_label_map_to_categories(         label_map,         max_num_classes=label_map_util.get_max_label_map_index(label_map),         use_display_name=True     )     category_index = label_map_util.create_category_index(categories)      # Class Name to Class ID mapping.     label_map_dict = label_map_util.get_label_map_dict(label_map, use_display_name=True)      return category_index, label_map_dict  # Load COCO labels. coco_category_index, coco_label_map_dict = load_coco_labels()  print('coco_category_index:', coco_category_index) print('coco_label_map_dict:', coco_label_map_dict)<\/code><\/pre>\n<p>  <\/p>\n<p><em>output \u2192<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">coco_category_index: {     1: {'id': 1, 'name': 'person'},     2: {'id': 2, 'name': 'bicycle'},     ...     90: {'id': 90, 'name': 'toothbrush'}, }  coco_label_map_dict: {     'background': 0,     'person': 1,     'bicycle': 2,     'car': 3,     ...     'toothbrush': 90, }<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"sozdaem-funkciyu-obnaruzheniya\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u0443\u044e \u043d\u0430\u043c\u0438 \u0440\u0430\u043d\u0435\u0435 \u043c\u043e\u0434\u0435\u043b\u044c, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438. <\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import tensorflow as tf  # Import Object Detection API helpers. from object_detection.utils import config_util from object_detection.builders import model_builder  # Generates the detection function for specific model and specific model's checkpoint def detection_fn_from_checkpoint(config_path, checkpoint_path):     # Build the model.     pipeline_config = config_util.get_configs_from_pipeline_file(config_path)     model_config = pipeline_config['model']     model = model_builder.build(         model_config=model_config,         is_training=False,     )      # Restore checkpoints.     ckpt = tf.compat.v2.train.Checkpoint(model=model)     ckpt.restore(checkpoint_path).expect_partial()      # This is a function that will do the detection.     @tf.function     def detect_fn(image):         image, shapes = model.preprocess(image)         prediction_dict = model.predict(image, shapes)         detections = model.postprocess(prediction_dict, shapes)          return detections, prediction_dict, tf.reshape(shapes, [-1])      return detect_fn  inference_detect_fn = detection_fn_from_checkpoint(     config_path=os.path.join('cache', 'datasets', MODEL_NAME, 'pipeline.config'),     checkpoint_path=os.path.join('cache', 'datasets', MODEL_NAME, 'checkpoint', 'ckpt-0'), )<\/code><\/pre>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>inference_detect_fn<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0432 \u043d\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>  <\/p>\n<h3 id=\"zagruzhaem-testovye-izobrazheniya\">\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9e7\/ca5\/057\/9e7ca505789722a51d11eeede2b2d3c3.jpg\" alt=\"General Object Inference\"><\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u044d\u0442\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u043f\u0430\u043f\u043a\u0443 <code>inference\/test\/<\/code> \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 Google Colab, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u0442\u0443 \u043f\u0430\u043f\u043a\u0443 \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0430\u0439\u043b\u0430 \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0430\u043f\u043e\u043a \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/17f\/dcc\/432\/17fdcc432317dd5e59a939360936b0b0.jpg\" alt=\"Folder structure\"><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import matplotlib.pyplot as plt %matplotlib inline  # Creating a TensorFlow dataset of just one image. inference_ds = tf.keras.preprocessing.image_dataset_from_directory(   directory='inference',   image_size=(640, 640),   batch_size=1,   shuffle=False,   label_mode=None ) # Numpy version of the dataset. inference_ds_numpy = list(inference_ds.as_numpy_iterator())  # You may preview the images in dataset like this. plt.figure(figsize=(14, 14)) for i, image in enumerate(inference_ds_numpy):     plt.subplot(2, 2, i + 1)     plt.imshow(image[0].astype(&quot;uint8&quot;))     plt.axis(&quot;off&quot;) plt.show()<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"zapuskaem-obnaruzhenie-dlya-testovogo-izobrazheniya\">\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435. \u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>inference_ds_numpy[0]<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0430\u0448\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>Numpy<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">detections, predictions_dict, shapes = inference_detect_fn(     inference_ds_numpy[0] )<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u0432\u0435\u0440\u043d\u0443\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">boxes = detections['detection_boxes'].numpy() scores = detections['detection_scores'].numpy() classes = detections['detection_classes'].numpy() num_detections = detections['num_detections'].numpy()[0]  print('boxes.shape: ', boxes.shape) print('scores.shape: ', scores.shape) print('classes.shape: ', classes.shape) print('num_detections:', num_detections)<\/code><\/pre>\n<p>  <\/p>\n<p><em>output \u2192<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">boxes.shape:  (1, 100, 4) scores.shape:  (1, 100) classes.shape:  (1, 100) num_detections: 100.0<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c \u0432\u0435\u0440\u043d\u0443\u043b\u0430 \u043d\u0430\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043e <code>100<\/code> &quot;\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f\u043c\u0438&quot;. \u042d\u0442\u043e \u043d\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430\u0448\u043b\u0430 <code>100<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438. \u042d\u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043d\u0430\u043c, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u0438\u043c\u0435\u0435\u0442 <code>100<\/code> \u044f\u0447\u0435\u0435\u043a \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c <code>100<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438. \u041a\u0430\u0436\u0434\u043e\u0435 &quot;\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435&quot; \u0438\u043c\u0435\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0439\u0442\u0438\u043d\u0433 (\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c, score), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e\u0431 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442. \u0413\u0430\u0431\u0430\u0440\u0438\u0442\u044b \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 <code>boxes<\/code>. \u0420\u0435\u0439\u0442\u0438\u043d\u0433 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 <code>scores<\/code>. \u041c\u0430\u0441\u0441\u0438\u0432 <code>classes<\/code> \u0445\u0440\u0430\u043d\u0438\u0442 \u044f\u0440\u043b\u044b\u043a\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e &quot;\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f&quot;.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043f\u0435\u0440\u0432\u044b\u0435 5 \u0442\u0430\u043a\u0438\u0445 &quot;\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0439&quot;:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print('First 5 boxes:') print(boxes[0,:5])  print('First 5 scores:') print(scores[0,:5])  print('First 5 classes:') print(classes[0,:5])  class_names = [coco_category_index[idx + 1]['name'] for idx in classes[0]] print('First 5 class names:') print(class_names[:5])<\/code><\/pre>\n<p>  <\/p>\n<p><em>output \u2192<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">First 5 boxes: [[0.17576033 0.84654826 0.25642633 0.88327974]  [0.5187813  0.12410264 0.6344235  0.34545377]  [0.5220358  0.5181462  0.6329132  0.7669856 ]  [0.50933677 0.7045719  0.5619138  0.7446198 ]  [0.44761637 0.51942706 0.61237675 0.75963426]]  First 5 scores: [0.6950246 0.6343004 0.591157  0.5827219 0.5415643]  First 5 classes: [9. 8. 8. 0. 8.]  First 5 class names: ['traffic light', 'boat', 'boat', 'person', 'boat']<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c \u0432\u0438\u0434\u0438\u0442 \u0441\u0432\u0435\u0442\u043e\u0444\u043e\u0440 (<code>traffic light<\/code>), \u0442\u0440\u0438 \u043b\u043e\u0434\u043a\u0438 (<code>boats<\/code>) \u0438 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 (<code>person<\/code>). \u0418 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 <code>scores<\/code> \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u0430 (\u0441 70% \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e) \u0432 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 <code>traffic light<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>boxes<\/code> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b <code>[y1, x1, y2, x2]<\/code>, \u0433\u0434\u0435 <code>(x1, y1)<\/code> \u0438 <code>(x2, y2)<\/code> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043b\u0435\u0432\u043e\u0433\u043e \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0438 \u043f\u0440\u0430\u0432\u043e\u0433\u043e \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u0443\u0433\u043b\u043e\u0432 \u0433\u0430\u0431\u0430\u0440\u0438\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0433\u0430\u0431\u0430\u0440\u0438\u0442\u043d\u044b\u0435 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># Importing Object Detection API helpers. from object_detection.utils import visualization_utils  # Visualizes the bounding boxes on top of the image. def visualize_detections(image_np, detections, category_index):     label_id_offset = 1     image_np_with_detections = image_np.copy()      visualization_utils.visualize_boxes_and_labels_on_image_array(         image_np_with_detections,         detections['detection_boxes'][0].numpy(),         (detections['detection_classes'][0].numpy() + label_id_offset).astype(int),         detections['detection_scores'][0].numpy(),         category_index,         use_normalized_coordinates=True,         max_boxes_to_draw=200,         min_score_thresh=.4,         agnostic_mode=False,     )      plt.figure(figsize=(12, 16))     plt.imshow(image_np_with_detections)     plt.show()  # Visualizing the detections. visualize_detections(     image_np=tf.cast(inference_ds_numpy[0][0], dtype=tf.uint32).numpy(),     detections=detections,     category_index=coco_category_index, )<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/931\/2de\/3c7\/9312de3c7465a05f9ddd12eca3d9d385.jpg\" alt=\"Inference result\"><\/p>\n<p>  <\/p>\n<p>\u0412 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/372\/fe5\/1fc\/372fe51fcd25300ff07e0bba1d94b846.jpg\" alt=\"Inference result for text image\"><\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0430 \u043d\u0430\u0439\u0442\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u0432 \u044d\u0442\u043e\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438. \u042d\u0442\u043e \u043a\u0430\u043a-\u0440\u0430\u0437 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0438 \u0447\u0435\u043c\u0443 \u0445\u043e\u0442\u0438\u043c \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u2014 \u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u0441\u0442\u0430\u0432\u043a\u0438 <code>https:\/\/<\/code> \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445.<\/p>\n<p>  <\/p>\n<h2 id=\"podgotavlivaem-nabor-dannyh-dlya-trenirovki\">\u041f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c <code>ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8<\/code> \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 <em>\u043d\u0435 \u0431\u044b\u043b\u0438<\/em> \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 COCO \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 &quot;\u0434\u043e\u0443\u0447\u0438\u0442\u044c&quot; \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u043d\u0435\u043c.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0431\u043e\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0447\u0430\u0442\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0438 \u043a\u043d\u0438\u0433\u0438 \u0438\u043b\u0438 \u0436\u0443\u0440\u043d\u0430\u043b\u0430)<\/li>\n<li>\u0413\u0430\u0431\u0430\u0440\u0438\u0442\u043d\u044b\u0435 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0433\u0434\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u044b.<\/li>\n<\/ol>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/be2\/5b4\/7e9\/be25b47e961629a02f8ed3a656535b42.jpg\" alt=\"Bounding Boxes\"><\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b <code>\u043b\u0435\u0432\u043e\u0433\u043e \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e<\/code> \u0438 <code>\u043f\u0440\u0430\u0432\u043e\u0433\u043e \u043d\u0438\u0436\u043d\u0435\u0433\u043e<\/code> \u0443\u0433\u043b\u043e\u0432 \u0438\u043c\u0435\u044e\u0442 <em>\u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435<\/em> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u0445). \u0422\u0430\u043a\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0442\u0430\u043a\u0438\u0445 \u0433\u0430\u0431\u0430\u0440\u0438\u0442\u043d\u044b\u0445 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0435\u0433\u043e <code>\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0446\u0435\u043d\u0442\u0440\u0430<\/code>, \u0430 \u0442\u0430\u043a \u0436\u0435 <code>\u0448\u0438\u0440\u0438\u043d\u044b<\/code> \u0438 <code>\u0432\u044b\u0441\u043e\u0442\u044b<\/code>. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>\u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435<\/em> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 (\u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u043e\u0442 \u0448\u0438\u0440\u0438\u043d\u044b \u0438\u043b\u0438 \u0432\u044b\u0441\u043e\u0442\u044b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f). \u041d\u043e \u0432 \u0446\u0435\u043b\u043e\u043c, \u0434\u0443\u043c\u0430\u044e \u0438\u0434\u0435\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u0430: \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u043d\u0430\u0442\u044c \u0433\u0434\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u043e\u0442 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u043f\u0440\u043e\u0441 \u0432 \u0442\u043e\u043c, \u0433\u0434\u0435 \u0436\u0435 \u043d\u0430\u043c \u0432\u0437\u044f\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430:<\/p>\n<p>  <\/p>\n<ol>\n<li><em>\u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043c\u0435\u044e\u0449\u0438\u043c\u0441\u044f<\/em> \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<li><em>\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439<\/em> \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<li><em>\u0421\u043e\u0437\u0434\u0430\u0442\u044c<\/em> \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0443\u0442\u0435\u043c \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u0438 <code>https:\/\/<\/code> \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438 \u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 (\u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432) \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/li>\n<\/ol>\n<p>  <\/p>\n<h3 id=\"variant-1-ispolzovanie-suschestvuyuschih-naborov-dannyh\">\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u21161: \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u0449\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/datasetsearch.research.google.com\/\" rel=\"nofollow\">Google Dataset Search<\/a><\/li>\n<li><a href=\"https:\/\/www.kaggle.com\/datasets\" rel=\"nofollow\">Kaggle Datasets<\/a><\/li>\n<li>\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 <a href=\"https:\/\/github.com\/awesomedata\/awesome-public-datasets\" rel=\"nofollow\">awesome-public-datasets<\/a><\/li>\n<li>\u0438 \u043f\u0440.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u2713 \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0435\u0439, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0439 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0442\u043e \u044d\u0442\u043e, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0447\u0430\u0442\u044c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0443 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<p>\u2717 \u041d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u043d\u0435 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a\u043d\u0438\u0433 \u0441\u043e \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438 \u0438 \u0438\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0430\u043c \u043f\u0440\u0438\u0439\u0434\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c.<\/p>\n<p>  <\/p>\n<h3 id=\"variant-2-generirovanie-iskusstvennogo-nabora-dannyh\">\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u21162: \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>  <\/p>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/keras-ocr.readthedocs.io\/en\/latest\/examples\/end_to_end_training.html#generating-synthetic-data\" rel=\"nofollow\">keras_ocr<\/a>), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0447\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442, \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u0441\u0441\u044b\u043b\u043a\u0443 \u0438 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u043e\u043d\u0430\u0445 \u0438 \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0438\u0441\u043a\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u2713 \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 <em>\u0448\u0440\u0438\u0444\u0442\u0430\u043c\u0438<\/em>, <em>\u043b\u0438\u0433\u0430\u0442\u0443\u0440\u0430\u043c\u0438<\/em>, <em>\u0446\u0432\u0435\u0442\u0430\u043c\u0438 \u0442\u0435\u043a\u0441\u0442\u0430<\/em> \u0438 <em>\u0444\u043e\u043d\u0430<\/em>. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u043b\u043e \u0431\u044b \u043d\u0430\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b <a href=\"https:\/\/en.wikipedia.org\/wiki\/Overfitting\" rel=\"nofollow\">\u043f\u0435\u0440\u0435\u0443\u0447\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0438<\/a>. \u041c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0433\u043b\u0430-\u0431\u044b \u043b\u0435\u0433\u043a\u043e \u043e\u0431\u043e\u0431\u0449\u0430\u0442\u044c \u0441\u0432\u043e\u0438 &quot;\u0437\u043d\u0430\u043d\u0438\u044f&quot; \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d\u0430 \u043d\u0435 \u0432\u0438\u0434\u0435\u043b\u0430 \u0440\u0430\u043d\u0435\u0435.<\/p>\n<p>  <\/p>\n<p>\u2713 \u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0441\u0441\u044b\u043b\u043e\u043a, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a: <code>http:\/\/<\/code>, <code>http:\/\/<\/code>, <code>ftp:\/\/<\/code>, <code>tcp:\/\/<\/code> \u0438 \u043f\u0440. \u0412\u0435\u0434\u044c \u043d\u0430\u0439\u0442\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0441\u0441\u044b\u043b\u043e\u043a \u043c\u043e\u0433\u043b\u043e \u0431\u044b \u0441\u0442\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439. <\/p>\n<p>  <\/p>\n<p>\u2713 \u0415\u0449\u0435 \u043e\u0434\u043d\u0438\u043c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0442\u0438\u043c. \u041c\u044b \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u044b \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0441\u043e \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438 \u0432 \u043a\u043d\u0438\u0433\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0430\u043c \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438. \u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0432 \u0438\u0442\u043e\u0433\u0435 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<p>\u2717 \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u0447\u0442\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043d\u0430\u0431\u043e\u0440\u0443<br \/>  \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0435\u043f\u0440\u0430\u0432\u0434\u043e\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0438\u0437\u0433\u0438\u0431\u044b \u0441\u0442\u0440\u0430\u043d\u0438\u0446 (\u0432\u043e\u043b\u043d\u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u0434\u0443\u0433\u0438) \u0438\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0434\u043e\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0444\u043e\u043d\u044b. \u041c\u043e\u0434\u0435\u043b\u044c \u0432 \u0442\u0430\u043a\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u043e\u0431\u043e\u0431\u0449\u0438\u0442\u044c \u0441\u0432\u043e\u0438 &quot;\u0437\u043d\u0430\u043d\u0438\u044f&quot; \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u0437 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0438\u0440\u0430.<\/p>\n<p>  <\/p>\n<blockquote><p>\u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0435\u0449\u0430\u044e\u0449\u0438\u043c. \u041e\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u043d\u0430\u043c \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 (\u043e \u043d\u0438\u0445 \u043c\u044b \u0443\u043f\u043e\u043c\u044f\u043d\u0435\u043c \u043d\u0438\u0436\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435). \u042f \u043f\u043e\u043a\u0430 \u0435\u0449\u0435 \u043d\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434, \u043d\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p><\/blockquote>\n<p>  <\/p>\n<h3 id=\"variant-3-sozdanie-nabora-dannyh-vruchnuyu\">\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u21163: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0440\u0443\u0447\u043d\u0443\u044e<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u044f\u043c\u043e\u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u2014 \u044d\u0442\u043e \u0432\u0437\u044f\u0442\u044c \u043a\u043d\u0438\u0433\u0443 (\u0438\u043b\u0438 \u043a\u043d\u0438\u0433\u0438), \u0441\u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u0432 <code>https:\/\/<\/code> \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<p>  <\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u0430\u044f \u043d\u043e\u0432\u043e\u0441\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c (\u0441\u043e\u0442\u043d\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e). \u042d\u0442\u043e \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u043b\u0435\u043d\u043e \u0442\u0435\u043c, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c <em>\u0441 \u043d\u0443\u043b\u044f<\/em>. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c &quot;\u0434\u043e\u0443\u0447\u0438\u0432\u0430\u0442\u044c&quot; \u0443\u0436\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c (\u0441\u043c. <a href=\"https:\/\/en.wikipedia.org\/wiki\/Transfer_learning\" rel=\"nofollow\">transfer learning<\/a> \u0438 <a href=\"https:\/\/paperswithcode.com\/task\/few-shot-learning\" rel=\"nofollow\">few-shot learning<\/a>).<\/p>\n<p>  <\/p>\n<p>\u2713 \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043c\u0438\u0440\u0443. \u041c\u044b \u0432 \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043a\u043d\u0438\u0433\u0443, \u0441\u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0438 \u0441 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0448\u0440\u0438\u0444\u0442\u0430\u043c\u0438, \u0438\u0437\u0433\u0438\u0431\u0430\u043c\u0438, \u0442\u0435\u043d\u044f\u043c\u0438 \u0438 \u0446\u0432\u0435\u0442\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u2717 \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0434\u0430\u0436\u0435 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0432\u0441\u0435\u0433\u043e \u0441\u043e\u0442\u043d\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u0435\u043a, \u0440\u0430\u0431\u043e\u0442\u0430 \u043f\u043e \u0441\u0431\u043e\u0440\u0443 \u0442\u0430\u043a\u0438\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u0435\u043a \u0438 \u0438\u0445 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>  <\/p>\n<p>\u2717 \u0422\u044f\u0436\u0435\u043b\u043e \u043d\u0430\u0439\u0442\u0438 \u0440\u0430\u0437\u043d\u044b\u0435 \u043a\u043d\u0438\u0433\u0438 \u0438 \u0436\u0443\u0440\u043d\u0430\u043b\u044b \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0448\u0440\u0438\u0444\u0442\u0430\u043c\u0438, \u0442\u0438\u043f\u0430\u043c\u0438 \u0441\u0441\u044b\u043b\u043e\u043a, \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0444\u043e\u043d\u0430\u043c\u0438 \u0438 \u043b\u0438\u0433\u0430\u0442\u0443\u0440\u0430\u043c\u0438. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u0437\u043a\u043e\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c (\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u0443\u0434\u0443\u0442 \u0431\u044b\u0442\u044c \u043a\u043d\u0438\u0433\u0438 \u0441\u043e \u0448\u0440\u0438\u0444\u0442\u0430\u043c\u0438 \u0438 \u0444\u043e\u043d\u0430\u043c\u0438 \u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438 \u043d\u0430 \u0432\u0430\u0448\u0438).<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0446\u0435\u043b\u044c\u044e \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e \u0432\u044b\u0448\u0435, \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0438\u0433\u0440\u0430\u0442\u044c \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0439\u0442\u0438 \u043f\u043e \u043f\u0443\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<p>  <\/p>\n<h3 id=\"obrabatyvaem-foto-dlya-nabora-dannyh\">\u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0444\u043e\u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>  <\/p>\n<p>\u042f \u0441\u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0440\u043e\u0432\u0430\u043b <code>125<\/code> \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u0435\u043a \u043e\u0434\u043d\u043e\u0439 \u043a\u043d\u0438\u0433\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u0448\u0435\u043b <code>https:\/\/<\/code> \u0441\u0441\u044b\u043b\u043a\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5ef\/088\/70a\/5ef08870a8d0193042c9da2c8aa8eb0c.jpg\" alt=\"Raw Dataset\"><\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u044b \u0432 \u043f\u0430\u043f\u043a\u0443 <code>dataset\/printed_links\/raw<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433 \u2014 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li><strong>\u0418\u0437\u043c\u0435\u043d\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440<\/strong> \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0438\u0445 \u0448\u0438\u0440\u0438\u043d\u0430 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0430 <code>1024px<\/code> (\u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u0447\u0435\u0440\u0435\u0441\u0447\u0443\u0440 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0441 \u0448\u0438\u0440\u0438\u043d\u043e\u0439 \u0432 <code>3024px<\/code>)<\/li>\n<li><strong>\u041e\u0431\u0440\u0435\u0436\u0435\u043c<\/strong> \u043a\u0430\u0436\u0434\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u043e \u0441\u0442\u0430\u043b\u043e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u043c (\u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0436\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0445 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u0439, \u043d\u0435 \u043e\u0431\u0440\u0435\u0437\u0430\u044f \u0435\u0433\u043e, \u043d\u043e \u044f \u0445\u043e\u0442\u0435\u043b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u0438 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u0432 <code>https:<\/code> \u043f\u0435\u0440\u0435\u0434 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435\u043c).<\/li>\n<li><strong>\u0420\u0430\u0437\u0432\u0435\u0440\u043d\u0435\u043c<\/strong> \u043a\u0430\u0436\u0434\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0432 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0442\u0435\u0433\u0430 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Exif\" rel=\"nofollow\">exif<\/a>.<\/li>\n<li><strong>\u0421\u0434\u0435\u043b\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u044b\u043c<\/strong>, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0440\u0430\u043b\u0430 \u0432\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0446\u0432\u0435\u0442.<\/li>\n<li><strong>\u0423\u0432\u0435\u043b\u0438\u0447\u0438\u043c \u044f\u0440\u043a\u043e\u0441\u0442\u044c<\/strong><\/li>\n<li><strong>\u0423\u0432\u0435\u043b\u0438\u0447\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442<\/strong><\/li>\n<li><strong>\u0423\u0432\u0435\u043b\u0438\u0447\u0438\u043c \u0440\u0435\u0437\u043a\u043e\u0441\u0442\u044c<\/strong><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0421\u0442\u043e\u0438\u0442\u044c \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u044d\u0442\u0438 \u0436\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u043d\u0430\u0434 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0445 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 (\u0435\u0441\u043b\u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u044b\u043c\u0438 \u0438 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u043c\u0438, \u0442\u043e \u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u0438\u043c\u0438 \u0436\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u043c\u0438 \u0438 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u044b\u043c\u0438).<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Python:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import os import math import shutil  from pathlib import Path from PIL import Image, ImageOps, ImageEnhance  # Resize an image. def preprocess_resize(target_width):     def preprocess(image: Image.Image, log) -&gt; Image.Image:         (width, height) = image.size         ratio = width \/ height          if width &gt; target_width:             target_height = math.floor(target_width \/ ratio)             log(f'Resizing: To size {target_width}x{target_height}')             image = image.resize((target_width, target_height))         else:             log('Resizing: Image already resized, skipping...')          return image     return preprocess  # Crop an image. def preprocess_crop_square():     def preprocess(image: Image.Image, log) -&gt; Image.Image:         (width, height) = image.size          left = 0         top = 0         right = width         bottom = height          crop_size = min(width, height)          if width &gt;= height:             # Horizontal image.             log(f'Squre cropping: Horizontal {crop_size}x{crop_size}')             left = width \/\/ 2 - crop_size \/\/ 2             right = left + crop_size         else:             # Vetyical image.             log(f'Squre cropping: Vertical {crop_size}x{crop_size}')             top = height \/\/ 2 - crop_size \/\/ 2             bottom = top + crop_size          image = image.crop((left, top, right, bottom))         return image     return preprocess  # Apply exif transpose to an image. def preprocess_exif_transpose():     # @see: https:\/\/pillow.readthedocs.io\/en\/stable\/reference\/ImageOps.html     def preprocess(image: Image.Image, log) -&gt; Image.Image:         log('EXif transpose')         image = ImageOps.exif_transpose(image)         return image     return preprocess  # Apply color transformations to the image. def preprocess_color(brightness, contrast, color, sharpness):     # @see: https:\/\/pillow.readthedocs.io\/en\/3.0.x\/reference\/ImageEnhance.html     def preprocess(image: Image.Image, log) -&gt; Image.Image:         log('Coloring')          enhancer = ImageEnhance.Color(image)         image = enhancer.enhance(color)          enhancer = ImageEnhance.Brightness(image)         image = enhancer.enhance(brightness)          enhancer = ImageEnhance.Contrast(image)         image = enhancer.enhance(contrast)          enhancer = ImageEnhance.Sharpness(image)         image = enhancer.enhance(sharpness)          return image     return preprocess  # Image pre-processing pipeline. def preprocess_pipeline(src_dir, dest_dir, preprocessors=[], files_num_limit=0, override=False):     # Create destination folder if not exists.     Path(dest_dir).mkdir(parents=False, exist_ok=True)      # Get the list of files to be copied.     src_file_names = os.listdir(src_dir)     files_total = files_num_limit if files_num_limit &gt; 0 else len(src_file_names)     files_processed = 0      # Logger function.     def preprocessor_log(message):         print('  ' + message)      # Iterate through files.     for src_file_index, src_file_name in enumerate(src_file_names):         if files_num_limit &gt; 0 and src_file_index &gt;= files_num_limit:             break          # Copy file.                 src_file_path = os.path.join(src_dir, src_file_name)         dest_file_path = os.path.join(dest_dir, src_file_name)          progress = math.floor(100 * (src_file_index + 1) \/ files_total)         print(f'Image {src_file_index + 1}\/{files_total} | {progress}% |  {src_file_path}')          if not os.path.isfile(src_file_path):             preprocessor_log('Source is not a file, skipping...\\n')             continue          if not override and os.path.exists(dest_file_path):             preprocessor_log('File already exists, skipping...\\n')             continue          shutil.copy(src_file_path, dest_file_path)         files_processed += 1          # Preprocess file.         image = Image.open(dest_file_path)          for preprocessor in preprocessors:             image = preprocessor(image, preprocessor_log)          image.save(dest_file_path, quality=95)         print('')      print(f'{files_processed} out of {files_total} files have been processed')  # Launching the image preprocessing pipeline. preprocess_pipeline(     src_dir='dataset\/printed_links\/raw',     dest_dir='dataset\/printed_links\/processed',     override=True,     # files_num_limit=1,     preprocessors=[         preprocess_exif_transpose(),         preprocess_resize(target_width=1024),         preprocess_crop_square(),         preprocess_color(brightness=2, contrast=1.3, color=0, sharpness=1),     ] )<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u0441\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u044b \u0432 \u043f\u0430\u043f\u043a\u0435 <code>dataset\/printed_links\/processed<\/code>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d57\/363\/353\/d573633530a534c4c87aeb4d0bc0f2d6.jpg\" alt=\"Dataset Processed\"><\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import matplotlib.pyplot as plt import numpy as np  def preview_images(images_dir, images_num=1, figsize=(15, 15)):     image_names = os.listdir(images_dir)     image_names = image_names[:images_num]      num_cells = math.ceil(math.sqrt(images_num))     figure = plt.figure(figsize=figsize)      for image_index, image_name in enumerate(image_names):         image_path = os.path.join(images_dir, image_name)         image = Image.open(image_path)          figure.add_subplot(num_cells, num_cells, image_index + 1)         plt.imshow(np.asarray(image))      plt.show()  preview_images('dataset\/printed_links\/processed', images_num=4, figsize=(16, 16))<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"ukazyvaem-pozicii-i-gabarity-obektov-dlya-nashego-nabora-dannyh\">\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438 \u0433\u0430\u0431\u0430\u0440\u0438\u0442\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438 \u0433\u0430\u0431\u0430\u0440\u0438\u0442\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u0432 <code>https:\/\/<\/code>) \u0432 \u043d\u0430\u0448\u0435\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 <a href=\"https:\/\/github.com\/tzutalin\/labelImg\" rel=\"nofollow\">LabelImg<\/a>.<\/p>\n<p>  <\/p>\n<blockquote><p>\u0412\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c LabelImg \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u043d\u0430 \u0432\u0430\u0448 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440. \u0414\u0435\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043f\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/github.com\/tzutalin\/labelImg\" rel=\"nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 LabelImg<\/a><\/p><\/blockquote>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 LabelImg, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u0443\u043a\u0430\u0437\u0430\u0432 \u043f\u0430\u043f\u043a\u0443 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <code>dataset\/printed_links\/processed<\/code>), \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">labelImg dataset\/printed_links\/processed<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0435\u043c\u0441\u044f \u043e\u043a\u043d\u0435 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u0437 \u043f\u0430\u043f\u043a\u0438 <code>dataset\/printed_links\/processed<\/code> \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 XML \u0432 \u043f\u0430\u043f\u043a\u0443 <code>dataset\/printed_links\/labels\/xml\/<\/code>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/84c\/3f7\/d93\/84c3f7d93cf84fce45d6093732c6ef01.jpg\" alt=\"Labeling\"><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1a6\/0a5\/6a4\/1a60a56a4a04291057f8b04ae1d6aed2.gif\" alt=\"Labeling Process\"><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c XML \u0444\u0430\u0439\u043b \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0435\u0439 \u0438 \u0433\u0430\u0431\u0430\u0440\u0438\u0442\u0430\u043c\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/bfa\/1a5\/24d\/bfa1a524d91a647ee2ecfcd419d1be74.jpg\" alt=\"Labels folder structure\"><\/p>\n<p>  <\/p>\n<h3 id=\"razbivaem-obschiy-nabor-dannyh-na-trenirovochnyy-i-testovyy-nabory\">\u0420\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u043e\u0431\u0449\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440\u044b<\/h3>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Overfitting\" rel=\"nofollow\">\u043f\u0435\u0440\u0435\u0443\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u043d\u0435\u0434\u043e\u0443\u0447\u0438\u0432\u0430\u043d\u0438\u044f<\/a> \u043c\u043e\u0434\u0435\u043b\u0438, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043d\u0430\u0448 \u043e\u0431\u0449\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440\u044b. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>80%<\/code> \u0432\u0441\u0435\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 <code>20%<\/code> \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438. \u0417\u0430\u0434\u0430\u0447\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u2014 \u043f\u043e\u043d\u044f\u0442\u044c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0448\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u043e\u0431\u0449\u0438\u0442\u044c \u0441\u0432\u043e\u0438 &quot;\u0437\u043d\u0430\u043d\u0438\u044f&quot; \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d\u0430 \u043d\u0435 &quot;\u0432\u0438\u0434\u0435\u043b\u0430&quot; \u0440\u0430\u043d\u044c\u0448\u0435.<\/p>\n<p>  <\/p>\n<blockquote><p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u043f\u0443\u0442\u0435\u043c \u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u044f \u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0430\u043f\u043a\u0438 (\u0432 \u043f\u0430\u043f\u043a\u0438 <code>test<\/code> \u0438 <code>train<\/code>). \u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c. \u0412\u043c\u0435\u0441\u0442\u043e \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0430\u043f\u043a\u0430\u0445 \u043c\u044b \u0442\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043f\u043e\u0434\u0433\u0440\u0443\u043f\u043f\u044b \u043d\u0430 \u043b\u0435\u0442\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/data\/Dataset\" rel=\"nofollow\">tf.data.Dataset<\/a>.<\/p><\/blockquote>\n<p>  <\/p>\n<pre><code class=\"python\">import re import random  def partition_dataset(     images_dir,     xml_labels_dir,     train_dir,     test_dir,     val_dir,     train_ratio,     test_ratio,     val_ratio,     copy_xml ):         if not os.path.exists(train_dir):         os.makedirs(train_dir)      if not os.path.exists(test_dir):         os.makedirs(test_dir)      if not os.path.exists(val_dir):         os.makedirs(val_dir)      images = [f for f in os.listdir(images_dir)               if re.search(r'([a-zA-Z0-9\\s_\\\\.\\-\\(\\):])+(.jpg|.jpeg|.png)$', f, re.IGNORECASE)]      num_images = len(images)      num_train_images = math.ceil(train_ratio * num_images)     num_test_images = math.ceil(test_ratio * num_images)     num_val_images = math.ceil(val_ratio * num_images)      print('Intended split')     print(f'  train: {num_train_images}\/{num_images} images')     print(f'  test: {num_test_images}\/{num_images} images')     print(f'  val: {num_val_images}\/{num_images} images')      actual_num_train_images = 0     actual_num_test_images = 0     actual_num_val_images = 0      def copy_random_images(num_images, dest_dir):         copied_num = 0          if not num_images:             return copied_num          for i in range(num_images):             if not len(images):                 break              idx = random.randint(0, len(images)-1)             filename = images[idx]             shutil.copyfile(os.path.join(images_dir, filename), os.path.join(dest_dir, filename))              if copy_xml:                 xml_filename = os.path.splitext(filename)[0]+'.xml'                 shutil.copyfile(os.path.join(xml_labels_dir, xml_filename), os.path.join(dest_dir, xml_filename))              images.remove(images[idx])             copied_num += 1          return copied_num      actual_num_train_images = copy_random_images(num_train_images, train_dir)     actual_num_test_images = copy_random_images(num_test_images, test_dir)     actual_num_val_images = copy_random_images(num_val_images, val_dir)      print('\\n', 'Actual split')     print(f'  train: {actual_num_train_images}\/{num_images} images')     print(f'  test: {actual_num_test_images}\/{num_images} images')     print(f'  val: {actual_num_val_images}\/{num_images} images')  partition_dataset(     images_dir='dataset\/printed_links\/processed',     train_dir='dataset\/printed_links\/partitioned\/train',     test_dir='dataset\/printed_links\/partitioned\/test',     val_dir='dataset\/printed_links\/partitioned\/val',     xml_labels_dir='dataset\/printed_links\/labels\/xml',     train_ratio=0.8,     test_ratio=0.2,     val_ratio=0,     copy_xml=True )<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0431\u0438\u0442\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0430\u043f\u043e\u043a \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">dataset\/ \u2514\u2500\u2500 printed_links     \u251c\u2500\u2500 labels     \u2502   \u2514\u2500\u2500 xml     \u251c\u2500\u2500 partitioned     \u2502   \u251c\u2500\u2500 test     \u2502   \u2514\u2500\u2500 train     \u2502       \u251c\u2500\u2500 IMG_9140.JPG     \u2502       \u251c\u2500\u2500 IMG_9140.xml     \u2502       \u251c\u2500\u2500 IMG_9141.JPG     \u2502       \u251c\u2500\u2500 IMG_9141.xml     \u2502       ...     \u251c\u2500\u2500 processed     \u2514\u2500\u2500 raw<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"eksportiruem-nabor-dannyh\">\u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0435\u0439 \u043d\u0430\u0434 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438, \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 <a href=\"https:\/\/www.tensorflow.org\/tutorials\/load_data\/tfrecord\" rel=\"nofollow\">TFRecord<\/a>. \u0424\u043e\u0440\u043c\u0430\u0442 <code>TFRecord<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f TensorFlow \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439).<\/p>\n<p>  <\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0432\u0435 \u043f\u0430\u043f\u043a\u0438: \u043e\u0434\u043d\u0443 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <code>CSV<\/code>, \u0434\u0440\u0443\u0433\u0443\u044e \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0439 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <code>TFRecord<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">mkdir -p dataset\/printed_links\/labels\/csv mkdir -p dataset\/printed_links\/tfrecords<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b-\u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f <code>dataset\/printed_links\/labels\/label_map.pbtxt<\/code> \u0441 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0448\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435\u0433\u043e <em>\u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043d\u0430\u0437\u043e\u0432\u0435\u043c <code>http<\/code>. \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">item {   id: 1   name: 'http' }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 TFRecord \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 <code>jpg<\/code> \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u0432 <code>xml<\/code> \u0444\u043e\u0440\u043c\u0430\u0442\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import os import io import math import glob import tensorflow as tf import pandas as pd import xml.etree.ElementTree as ET from PIL import Image from collections import namedtuple from object_detection.utils import dataset_util, label_map_util  tf1 = tf.compat.v1  # Convers labels from XML format to CSV. def xml_to_csv(path):     xml_list = []     for xml_file in glob.glob(path + '\/*.xml'):         tree = ET.parse(xml_file)         root = tree.getroot()         for member in root.findall('object'):             value = (root.find('filename').text,                 int(root.find('size')[0].text),                 int(root.find('size')[1].text),                 member[0].text,                 int(member[4][0].text),                 int(member[4][1].text),                 int(member[4][2].text),                 int(member[4][3].text)             )             xml_list.append(value)     column_name = ['filename', 'width', 'height', 'class', 'xmin', 'ymin', 'xmax', 'ymax']     xml_df = pd.DataFrame(xml_list, columns=column_name)     return xml_df  def class_text_to_int(row_label, label_map_dict):     return label_map_dict[row_label]  def split(df, group):     data = namedtuple('data', ['filename', 'object'])     gb = df.groupby(group)     return [data(filename, gb.get_group(x)) for filename, x in zip(gb.groups.keys(), gb.groups)]  # Creates a TFRecord. def create_tf_example(group, path, label_map_dict):     with tf1.gfile.GFile(os.path.join(path, '{}'.format(group.filename)), 'rb') as fid:         encoded_jpg = fid.read()      encoded_jpg_io = io.BytesIO(encoded_jpg)     image = Image.open(encoded_jpg_io)     width, height = image.size      filename = group.filename.encode('utf8')     image_format = b'jpg'     xmins = []     xmaxs = []     ymins = []     ymaxs = []     classes_text = []     classes = []      for index, row in group.object.iterrows():         xmins.append(row['xmin'] \/ width)         xmaxs.append(row['xmax'] \/ width)         ymins.append(row['ymin'] \/ height)         ymaxs.append(row['ymax'] \/ height)         classes_text.append(row['class'].encode('utf8'))         classes.append(class_text_to_int(row['class'], label_map_dict))      tf_example = tf1.train.Example(features=tf1.train.Features(feature={         'image\/height': dataset_util.int64_feature(height),         'image\/width': dataset_util.int64_feature(width),         'image\/filename': dataset_util.bytes_feature(filename),         'image\/source_id': dataset_util.bytes_feature(filename),         'image\/encoded': dataset_util.bytes_feature(encoded_jpg),         'image\/format': dataset_util.bytes_feature(image_format),         'image\/object\/bbox\/xmin': dataset_util.float_list_feature(xmins),         'image\/object\/bbox\/xmax': dataset_util.float_list_feature(xmaxs),         'image\/object\/bbox\/ymin': dataset_util.float_list_feature(ymins),         'image\/object\/bbox\/ymax': dataset_util.float_list_feature(ymaxs),         'image\/object\/class\/text': dataset_util.bytes_list_feature(classes_text),         'image\/object\/class\/label': dataset_util.int64_list_feature(classes),     }))      return tf_example  def dataset_to_tfrecord(     images_dir,     xmls_dir,      label_map_path,     output_path,     csv_path=None ):     label_map = label_map_util.load_labelmap(label_map_path)     label_map_dict = label_map_util.get_label_map_dict(label_map)      tfrecord_writer = tf1.python_io.TFRecordWriter(output_path)     images_path = os.path.join(images_dir)     csv_examples = xml_to_csv(xmls_dir)     grouped_examples = split(csv_examples, 'filename')      for group in grouped_examples:         tf_example = create_tf_example(group, images_path, label_map_dict)         tfrecord_writer.write(tf_example.SerializeToString())      tfrecord_writer.close()      print('Successfully created the TFRecord file: {}'.format(output_path))      if csv_path is not None:         csv_examples.to_csv(csv_path, index=None)         print('Successfully created the CSV file: {}'.format(csv_path))  # Generate a TFRecord for train dataset. dataset_to_tfrecord(     images_dir='dataset\/printed_links\/partitioned\/train',     xmls_dir='dataset\/printed_links\/partitioned\/train',     label_map_path='dataset\/printed_links\/labels\/label_map.pbtxt',     output_path='dataset\/printed_links\/tfrecords\/train.record',     csv_path='dataset\/printed_links\/labels\/csv\/train.csv' )  # Generate a TFRecord for test dataset. dataset_to_tfrecord(     images_dir='dataset\/printed_links\/partitioned\/test',     xmls_dir='dataset\/printed_links\/partitioned\/test',     label_map_path='dataset\/printed_links\/labels\/label_map.pbtxt',     output_path='dataset\/printed_links\/tfrecords\/test.record',     csv_path='dataset\/printed_links\/labels\/csv\/test.csv' )<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b <code>test.record<\/code> \u0438 <code>train.record<\/code> \u0432 \u043f\u0430\u043f\u043a\u0435 <code>dataset\/printed_links\/tfrecords\/<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">dataset\/ \u2514\u2500\u2500 printed_links     \u251c\u2500\u2500 labels     \u2502   \u251c\u2500\u2500 csv     \u2502   \u251c\u2500\u2500 label_map.pbtxt     \u2502   \u2514\u2500\u2500 xml     \u251c\u2500\u2500 partitioned     \u2502   \u251c\u2500\u2500 test     \u2502   \u251c\u2500\u2500 train     \u2502   \u2514\u2500\u2500 val     \u251c\u2500\u2500 processed     \u251c\u2500\u2500 raw     \u2514\u2500\u2500 tfrecords         \u251c\u2500\u2500 test.record         \u2514\u2500\u2500 train.record<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u0438 \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430 <code>test.record<\/code> \u0438 <code>train.record<\/code> \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 <code>ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8<\/code>.<\/p>\n<p>  <\/p>\n<h2 id=\"rabotaem-s-naborom-dannyh-v-formate-tfrecord\">\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 TFRecord<\/h2>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <code>TFRecord<\/code> \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0432 TensorFlow 2 Object Detection API.<\/p>\n<p>  <\/p>\n<p><strong>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import tensorflow as tf  # Count the number of examples in the dataset. def count_tfrecords(tfrecords_filename):     raw_dataset = tf.data.TFRecordDataset(tfrecords_filename)     # Keep in mind that the list() operation might be     # a performance bottleneck for large datasets.      return len(list(raw_dataset))  TRAIN_RECORDS_NUM = count_tfrecords('dataset\/printed_links\/tfrecords\/train.record') TEST_RECORDS_NUM = count_tfrecords('dataset\/printed_links\/tfrecords\/test.record')  print('TRAIN_RECORDS_NUM: ', TRAIN_RECORDS_NUM) print('TEST_RECORDS_NUM:  ', TEST_RECORDS_NUM)<\/code><\/pre>\n<p>  <\/p>\n<p><em>output \u2192<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">TRAIN_RECORDS_NUM:  100 TEST_RECORDS_NUM:   25<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 <code>100<\/code> \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u0445 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0435\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043a \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u0438\u044e \u043d\u0430 <code>25<\/code> \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445.<\/p>\n<p>  <\/p>\n<p><strong>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0433\u0430\u0431\u0430\u0440\u0438\u0442\u044b \u0438 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445<\/strong><\/p>\n<p>  <\/p>\n<p>\u041e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0433\u0430\u0431\u0430\u0440\u0438\u0442\u044b \u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import tensorflow as tf import numpy as np from google.protobuf import text_format import matplotlib.pyplot as plt  # Import Object Detection API. from object_detection.utils import visualization_utils from object_detection.protos import string_int_label_map_pb2 from object_detection.data_decoders.tf_example_decoder import TfExampleDecoder  %matplotlib inline  # Visualize the TFRecord dataset. def visualize_tfrecords(tfrecords_filename, label_map=None, print_num=1):     decoder = TfExampleDecoder(         label_map_proto_file=label_map,         use_display_name=False     )      if label_map is not None:         label_map_proto = string_int_label_map_pb2.StringIntLabelMap()          with tf.io.gfile.GFile(label_map,'r') as f:             text_format.Merge(f.read(), label_map_proto)             class_dict = {}              for entry in label_map_proto.item:                 class_dict[entry.id] = {'name': entry.name}      raw_dataset = tf.data.TFRecordDataset(tfrecords_filename)      for raw_record in raw_dataset.take(print_num):         example = decoder.decode(raw_record)          image = example['image'].numpy()         boxes = example['groundtruth_boxes'].numpy()         confidences = example['groundtruth_image_confidences']         filename = example['filename']         area = example['groundtruth_area']         classes = example['groundtruth_classes'].numpy()         image_classes = example['groundtruth_image_classes']         weights = example['groundtruth_weights']          scores = np.ones(boxes.shape[0])          visualization_utils.visualize_boxes_and_labels_on_image_array(              image,                                                            boxes,                                                                  classes,             scores,             class_dict,             max_boxes_to_draw=None,             use_normalized_coordinates=True         )          plt.figure(figsize=(8, 8))         plt.imshow(image)      plt.show()  # Visualizing the training TFRecord dataset. visualize_tfrecords(     tfrecords_filename='dataset\/printed_links\/tfrecords\/train.record',     label_map='dataset\/printed_links\/labels\/label_map.pbtxt',     print_num=3 )<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u043c\u0438 \u0433\u0430\u0431\u0430\u0440\u0438\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432,<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ae6\/3de\/066\/ae63de06652048e7989d778b786dfec0.jpg\" alt=\"TFRecord Preview\"><\/p>\n<p>  <\/p>\n<h2 id=\"ustanavlivaem-tensorboard\">\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c TensorBoard<\/h2>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <a href=\"https:\/\/www.tensorflow.org\/tensorboard\" rel=\"nofollow\">TensorBoard<\/a>.<\/p>\n<p>  <\/p>\n<p>TensorBoard \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u0432 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0435 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041e\u043d \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0438\u043b\u0438 \u0436\u0435 \u043d\u0430\u043c \u043b\u0443\u0447\u0448\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0443 \u0438 \u043f\u043e\u0434\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438. TensorBoard \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u043a\u0430\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438 \u0433\u0434\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043d\u0430\u0448\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d5e\/e9f\/7ae\/d5ee9f7aee1b94550125340243d5ccf5.gif\" alt=\"TensorBoard\"><\/p>\n<p>  <\/p>\n<p><em>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f: <a href=\"https:\/\/www.tensorflow.org\/tensorboard\" rel=\"nofollow\">\u0434\u043e\u043c\u0430\u0448\u043d\u044f\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 TensorBoard<\/a><\/em><\/p>\n<p>  <\/p>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e\u0439 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e TensorBoard \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u044f\u043c\u043e \u0432 Google Colab. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u044b \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0435 \u0441 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0432 Jupyter \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0435, \u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/github.com\/tensorflow\/tensorboard\/blob\/master\/README.md\" rel=\"nofollow\">\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c TensorBoard \u043a\u0430\u043a Python \u043f\u0430\u043a\u0435\u0442<\/a> \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0430\u043f\u043a\u0443 <code>.\/logs<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">mkdir -p logs<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435, \u043c\u044b \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 TensorBoard \u0432 Google Colab:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">%load_ext tensorboard<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c TensorBoard \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 <code>.\/logs<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u043f\u043a\u0438 \u0441 \u043b\u043e\u0433\u0430\u043c\u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438,<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">%tensorboard --logdir .\/logs<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0443\u0441\u0442\u0443\u044e \u043f\u0430\u043d\u0435\u043b\u044c TensorBoard:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/95e\/558\/1c4\/95e5581c409416c73ade13bd383b8274.jpg\" alt=\"Empty TensorBoard Panel\"><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u043d\u0430\u0447\u043d\u0435\u043c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0443, \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043a \u044d\u0442\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u043d\u0430 \u043e\u0431\u0443\u0447\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<h2 id=\"-trenirovka-modeli\">\u200d\ufe0f \u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0438<\/h2>\n<p>  <\/p>\n<h3 id=\"nastraivaem-parametry-trenirovki\">\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438<\/h3>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043a \u0440\u0430\u043d\u0435\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 <code>cache\/datasets\/ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8\/pipeline.config<\/code>. \u0412 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 <code>ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b <code>pipeline.config<\/code> \u0432 \u043a\u043e\u0440\u0435\u043d\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e <strong>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0430\u0441\u0441\u043e\u0432<\/strong> \u0441 <code>90<\/code> (\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 COCO) \u043d\u0430 <code>1<\/code> (\u043d\u0430\u0448 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>http<\/code>)<\/li>\n<li>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c <strong>\u0440\u0430\u0437\u043c\u0435\u0440 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430<\/strong> (batch size) \u0434\u043e <code>8<\/code> \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 \u043e\u0434\u0438\u043d \u043f\u0430\u043a\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u043c \u043f\u0430\u043c\u044f\u0442\u0438.<\/li>\n<li>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0435 <strong>\u0441\u043b\u0435\u043f\u043a\u0438<\/strong> \u0440\u0430\u043d\u0435\u0435 \u043d\u0430\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u043c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u0441 \u043d\u0443\u043b\u044f.<\/li>\n<li>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>fine_tune_checkpoint_type<\/code> \u0432 <code>detection<\/code>.<\/li>\n<li>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438, \u0433\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <strong>\u043a\u0430\u0440\u0442\u0430 \u043d\u043e\u0432\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432<\/strong> \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/li>\n<li>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438, \u0433\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f <strong>\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/strong>.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u044d\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0432 \u0444\u0430\u0439\u043b\u0435 <code>pipeline.config<\/code>, \u043d\u043e \u044d\u0442\u043e \u0442\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import tensorflow as tf from shutil import copyfile from google.protobuf import text_format from object_detection.protos import pipeline_pb2  # Adjust pipeline config modification here if needed. def modify_config(pipeline):     # Model config.     pipeline.model.ssd.num_classes = 1          # Train config.     pipeline.train_config.batch_size = 8      pipeline.train_config.fine_tune_checkpoint = 'cache\/datasets\/ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8\/checkpoint\/ckpt-0'     pipeline.train_config.fine_tune_checkpoint_type = 'detection'      # Train input reader config.     pipeline.train_input_reader.label_map_path = 'dataset\/printed_links\/labels\/label_map.pbtxt'     pipeline.train_input_reader.tf_record_input_reader.input_path[0] = 'dataset\/printed_links\/tfrecords\/train.record'      # Eval input reader config.     pipeline.eval_input_reader[0].label_map_path = 'dataset\/printed_links\/labels\/label_map.pbtxt'     pipeline.eval_input_reader[0].tf_record_input_reader.input_path[0] = 'dataset\/printed_links\/tfrecords\/test.record'      return pipeline  def clone_pipeline_config():     copyfile(         'cache\/datasets\/ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8\/pipeline.config',         'pipeline.config'     )  def setup_pipeline(pipeline_config_path):     clone_pipeline_config()     pipeline = read_pipeline_config(pipeline_config_path)     pipeline = modify_config(pipeline)     write_pipeline_config(pipeline_config_path, pipeline)     return pipeline  def read_pipeline_config(pipeline_config_path):     pipeline = pipeline_pb2.TrainEvalPipelineConfig()                                                                                                                                                                                                               with tf.io.gfile.GFile(pipeline_config_path, &quot;r&quot;) as f:                                                                                                                                                                                                                              proto_str = f.read()                                                                                                                                                                                                                                                   text_format.Merge(proto_str, pipeline)     return pipeline  def write_pipeline_config(pipeline_config_path, pipeline):     config_text = text_format.MessageToString(pipeline)                                                                                                                                                                                                             with tf.io.gfile.GFile(pipeline_config_path, &quot;wb&quot;) as f:                                                                                                                                                                                                                                f.write(config_text)  # Adjusting the pipeline configuration. pipeline = setup_pipeline('pipeline.config')  print(pipeline)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0444\u0430\u0439\u043b\u0430 <code>pipeline.config<\/code> \u043f\u043e\u0441\u043b\u0435 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">model {   ssd {     num_classes: 1     image_resizer {       fixed_shape_resizer {         height: 640         width: 640       }     }     feature_extractor {       type: &quot;ssd_mobilenet_v2_fpn_keras&quot;       depth_multiplier: 1.0       min_depth: 16       conv_hyperparams {         regularizer {           l2_regularizer {             weight: 3.9999998989515007e-05           }         }         initializer {           random_normal_initializer {             mean: 0.0             stddev: 0.009999999776482582           }         }         activation: RELU_6         batch_norm {           decay: 0.996999979019165           scale: true           epsilon: 0.0010000000474974513         }       }       use_depthwise: true       override_base_feature_extractor_hyperparams: true       fpn {         min_level: 3         max_level: 7         additional_layer_depth: 128       }     }     box_coder {       faster_rcnn_box_coder {         y_scale: 10.0         x_scale: 10.0         height_scale: 5.0         width_scale: 5.0       }     }     matcher {       argmax_matcher {         matched_threshold: 0.5         unmatched_threshold: 0.5         ignore_thresholds: false         negatives_lower_than_unmatched: true         force_match_for_each_row: true         use_matmul_gather: true       }     }     similarity_calculator {       iou_similarity {       }     }     box_predictor {       weight_shared_convolutional_box_predictor {         conv_hyperparams {           regularizer {             l2_regularizer {               weight: 3.9999998989515007e-05             }           }           initializer {             random_normal_initializer {               mean: 0.0               stddev: 0.009999999776482582             }           }           activation: RELU_6           batch_norm {             decay: 0.996999979019165             scale: true             epsilon: 0.0010000000474974513           }         }         depth: 128         num_layers_before_predictor: 4         kernel_size: 3         class_prediction_bias_init: -4.599999904632568         share_prediction_tower: true         use_depthwise: true       }     }     anchor_generator {       multiscale_anchor_generator {         min_level: 3         max_level: 7         anchor_scale: 4.0         aspect_ratios: 1.0         aspect_ratios: 2.0         aspect_ratios: 0.5         scales_per_octave: 2       }     }     post_processing {       batch_non_max_suppression {         score_threshold: 9.99999993922529e-09         iou_threshold: 0.6000000238418579         max_detections_per_class: 100         max_total_detections: 100         use_static_shapes: false       }       score_converter: SIGMOID     }     normalize_loss_by_num_matches: true     loss {       localization_loss {         weighted_smooth_l1 {         }       }       classification_loss {         weighted_sigmoid_focal {           gamma: 2.0           alpha: 0.25         }       }       classification_weight: 1.0       localization_weight: 1.0     }     encode_background_as_zeros: true     normalize_loc_loss_by_codesize: true     inplace_batchnorm_update: true     freeze_batchnorm: false   } } train_config {   batch_size: 8   data_augmentation_options {     random_horizontal_flip {     }   }   data_augmentation_options {     random_crop_image {       min_object_covered: 0.0       min_aspect_ratio: 0.75       max_aspect_ratio: 3.0       min_area: 0.75       max_area: 1.0       overlap_thresh: 0.0     }   }   sync_replicas: true   optimizer {     momentum_optimizer {       learning_rate {         cosine_decay_learning_rate {           learning_rate_base: 0.07999999821186066           total_steps: 50000           warmup_learning_rate: 0.026666000485420227           warmup_steps: 1000         }       }       momentum_optimizer_value: 0.8999999761581421     }     use_moving_average: false   }   fine_tune_checkpoint: &quot;cache\/datasets\/ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8\/checkpoint\/ckpt-0&quot;   num_steps: 50000   startup_delay_steps: 0.0   replicas_to_aggregate: 8   max_number_of_boxes: 100   unpad_groundtruth_tensors: false   fine_tune_checkpoint_type: &quot;detection&quot;   fine_tune_checkpoint_version: V2 } train_input_reader {   label_map_path: &quot;dataset\/printed_links\/labels\/label_map.pbtxt&quot;   tf_record_input_reader {     input_path: &quot;dataset\/printed_links\/tfrecords\/train.record&quot;   } } eval_config {   metrics_set: &quot;coco_detection_metrics&quot;   use_moving_averages: false } eval_input_reader {   label_map_path: &quot;dataset\/printed_links\/labels\/label_map.pbtxt&quot;   shuffle: false   num_epochs: 1   tf_record_input_reader {     input_path: &quot;dataset\/printed_links\/tfrecords\/test.record&quot;   } }<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"zapuskaem-process-trenirovki\">\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438<\/h3>\n<p>  <\/p>\n<p>\u041c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f TensorFlow 2 Object Detection API. API \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0444\u0430\u0439\u043b <a href=\"https:\/\/github.com\/tensorflow\/models\/blob\/master\/research\/object_detection\/model_main_tf2.py\" rel=\"nofollow\">model_main_tf2.py<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0435\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c Python \u043a\u043e\u0434\u043e\u043c \u0444\u0430\u0439\u043b\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>num_train_steps<\/code>, <code>model_dir<\/code> \u0438 \u043f\u0440.). <\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 <code>1000<\/code> \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 (\u044d\u043f\u043e\u0445).<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">%%bash  NUM_TRAIN_STEPS=1000 CHECKPOINT_EVERY_N=1000  PIPELINE_CONFIG_PATH=pipeline.config MODEL_DIR=.\/logs SAMPLE_1_OF_N_EVAL_EXAMPLES=1  python .\/models\/research\/object_detection\/model_main_tf2.py \\   --model_dir=$MODEL_DIR \\   --num_train_steps=$NUM_TRAIN_STEPS \\   --sample_1_of_n_eval_examples=$SAMPLE_1_OF_N_EVAL_EXAMPLES \\   --pipeline_config_path=$PIPELINE_CONFIG_PATH \\   --checkpoint_every_n=$CHECKPOINT_EVERY_N \\   --alsologtostderr<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 (\u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c <code>~10<\/code> \u043c\u0438\u043d\u0443\u0442 \u0434\u043b\u044f <code>1000<\/code> \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/colab.research.google.com\/notebooks\/gpu.ipynb\" rel=\"nofollow\">GPU runtime<\/a> \u0432 GoogleColab) \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043a\u0430\u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u0432 TensorBoard. \u041e\u0448\u0438\u0431\u043a\u0438 <code>localization<\/code> \u0438 <code>classification<\/code> \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u0441\u0435 \u043b\u0443\u0447\u0448\u0435 \u0438 \u043b\u0443\u0447\u0448\u0435 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0438\u0445 \u043a\u043b\u0430\u0441\u0441. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f0e\/e38\/bed\/f0ee38bedbfe135b3b118411cdb68c50.jpg\" alt=\"Training Process\"><\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043f\u043e \u043c\u0435\u0440\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u043f\u0430\u043f\u043a\u0435 <code>logs<\/code> \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u044b (\u0441\u043b\u0435\u043f\u043a\u0438) \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<p>\u041f\u0430\u043f\u043a\u0430 <code>logs<\/code> \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">logs \u251c\u2500\u2500 checkpoint \u251c\u2500\u2500 ckpt-1.data-00000-of-00001 \u251c\u2500\u2500 ckpt-1.index \u2514\u2500\u2500 train     \u2514\u2500\u2500 events.out.tfevents.1606560330.b314c371fa10.1747.1628.v2<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"ocenivaem-model-opcionalno\">\u041e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e)<\/h3>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u044b \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u0437 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u0430\u043a\u043e\u0439 \u043e\u0446\u0435\u043d\u043a\u0438 \u043e\u0431\u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 <a href=\"https:\/\/github.com\/tensorflow\/models\/blob\/master\/research\/object_detection\/g3doc\/evaluation_protocols.md\" rel=\"nofollow\">\u043c\u0435\u0442\u0440\u0438\u043a<\/a>, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0441 \u0442\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f <a href=\"https:\/\/tensorflow-object-detection-api-tutorial.readthedocs.io\/en\/latest\/training.html#evaluating-the-model-optional\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u044d\u0442\u043e\u0442 \u0448\u0430\u0433 \u0441 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c\u0438, \u043d\u043e \u043c\u044b \u0432\u0441\u0435-\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0430\u043d\u0435\u043b\u044c\u044e TensorBoard, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">%%bash  PIPELINE_CONFIG_PATH=pipeline.config MODEL_DIR=logs  python .\/models\/research\/object_detection\/model_main_tf2.py \\   --model_dir=$MODEL_DIR \\   --pipeline_config_path=$PIPELINE_CONFIG_PATH \\   --checkpoint_dir=$MODEL_DIR \\<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0441 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0432 \u043d\u0438\u0445 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/4e7\/70b\/282\/4e770b2825aa52724dd190abec9b4384.jpg\" alt=\"Model Evaluation\"><\/p>\n<p>  <\/p>\n<h2 id=\"eksportiruem-model\">\u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u0414\u043b\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c <a href=\"https:\/\/github.com\/tensorflow\/models\/blob\/master\/research\/object_detection\/exporter_main_v2.py\" rel=\"nofollow\">exporter_main_v2.py<\/a> \u0438\u0437 Object Detection API. \u042d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 TensorFlow \u0433\u0440\u0430\u0444 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0435\u0435 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u0430\u043f\u043a\u0443 \u0441 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0430\u043c\u0438, \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 SavedModel \u0438 \u043a\u043e\u043f\u0438\u0435\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">%%bash  python .\/models\/research\/object_detection\/exporter_main_v2.py \\     --input_type=image_tensor \\     --pipeline_config_path=pipeline.config \\     --trained_checkpoint_dir=logs \\     --output_directory=exported\/ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u0430\u043f\u043a\u0438 <code>exported<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">exported \u2514\u2500\u2500 ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8     \u251c\u2500\u2500 checkpoint     \u2502   \u251c\u2500\u2500 checkpoint     \u2502   \u251c\u2500\u2500 ckpt-0.data-00000-of-00001     \u2502   \u2514\u2500\u2500 ckpt-0.index     \u251c\u2500\u2500 pipeline.config     \u2514\u2500\u2500 saved_model         \u251c\u2500\u2500 assets         \u251c\u2500\u2500 saved_model.pb         \u2514\u2500\u2500 variables             \u251c\u2500\u2500 variables.data-00000-of-00001             \u2514\u2500\u2500 variables.index<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u043f\u0430\u043f\u043a\u0435 <code>saved_model<\/code>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0443\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<h2 id=\"ispolzovanie-eksportirovannoy-modeli\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438<\/h2>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c, \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u044d\u0442\u0430\u043f\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c. \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0438 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import time import math  PATH_TO_SAVED_MODEL = 'exported\/ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8\/saved_model'  def detection_function_from_saved_model(saved_model_path):     print('Loading saved model...', end='')     start_time = time.time()      # Load saved model and build the detection function     detect_fn = tf.saved_model.load(saved_model_path)      end_time = time.time()     elapsed_time = end_time - start_time      print('Done! Took {} seconds'.format(math.ceil(elapsed_time)))      return detect_fn  exported_detect_fn = detection_function_from_saved_model(     PATH_TO_SAVED_MODEL )<\/code><\/pre>\n<p>  <\/p>\n<p><em>output \u2192<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Loading saved model...Done! Took 9 seconds<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0441 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043d\u0430\u043c \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043a\u0430\u0440\u0442\u0443 \u043a\u043b\u0430\u0441\u0441\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from object_detection.utils import label_map_util  category_index = label_map_util.create_category_index_from_labelmap(     'dataset\/printed_links\/labels\/label_map.pbtxt',     use_display_name=True )  print(category_index)<\/code><\/pre>\n<p>  <\/p>\n<p><em>output \u2192<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{1: {'id': 1, 'name': 'http'}}<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import matplotlib.pyplot as plt import tensorflow as tf import numpy as np  from object_detection.utils import visualization_utils from object_detection.data_decoders.tf_example_decoder import TfExampleDecoder  %matplotlib inline  def tensors_from_tfrecord(     tfrecords_filename,     tfrecords_num,     dtype=tf.float32 ):     decoder = TfExampleDecoder()     raw_dataset = tf.data.TFRecordDataset(tfrecords_filename)     images = []      for raw_record in raw_dataset.take(tfrecords_num):         example = decoder.decode(raw_record)         image = example['image']         image = tf.cast(image, dtype=dtype)         images.append(image)      return images  def test_detection(tfrecords_filename, tfrecords_num, detect_fn):     image_tensors = tensors_from_tfrecord(         tfrecords_filename,         tfrecords_num,         dtype=tf.uint8     )      for image_tensor in image_tensors:            image_np = image_tensor.numpy()          # The model expects a batch of images, so add an axis with `tf.newaxis`.         input_tensor = tf.expand_dims(image_tensor, 0)          detections = detect_fn(input_tensor)          # All outputs are batches tensors.         # Convert to numpy arrays, and take index [0] to remove the batch dimension.         # We're only interested in the first num_detections.         num_detections = int(detections.pop('num_detections'))          detections = {key: value[0, :num_detections].numpy() for key, value in detections.items()}         detections['num_detections'] = num_detections          # detection_classes should be ints.         detections['detection_classes'] = detections['detection_classes'].astype(np.int64)          image_np_with_detections = image_np.astype(int).copy()          visualization_utils.visualize_boxes_and_labels_on_image_array(             image_np_with_detections,             detections['detection_boxes'],             detections['detection_classes'],             detections['detection_scores'],             category_index,             use_normalized_coordinates=True,             max_boxes_to_draw=100,             min_score_thresh=.3,             agnostic_mode=False         )          plt.figure(figsize=(8, 8))         plt.imshow(image_np_with_detections)      plt.show()  test_detection(     tfrecords_filename='dataset\/printed_links\/tfrecords\/test.record',     tfrecords_num=10,     detect_fn=exported_detect_fn )<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c <code>10<\/code> \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438\u0437 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0438 \u043f\u043e\u0434\u0441\u0432\u0435\u0447\u0435\u043d\u043d\u044b\u043c\u0438 <code>https:<\/code> \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/61a\/ef3\/15a\/61aef315a3caa1f60ef57bf4df5c450f.jpg\" alt=\"Testing the model on a test dataset\"><\/p>\n<p>  <\/p>\n<p>\u0422\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043c\u043e\u0433\u043b\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u044b <code>https:\/\/<\/code>) \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d\u0430 \u0440\u0430\u043d\u044c\u0448\u0435 \u043d\u0435 &quot;\u0432\u0438\u0434\u0435\u043b\u0430&quot; \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0437\u043d\u0430\u043a\u043e\u043c \u0438, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0442\u0435\u043c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442\u044c \u044d\u0442\u043e\u0439 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u043e\u0439.<\/p>\n<p>  <\/p>\n<h2 id=\"konvertiruem-model-v-veb-sovmestimyy-format\">\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u0432\u0435\u0431-\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442<\/h2>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u043f\u043e\u043c\u043d\u0438\u0442\u0435 \u0438\u0437 \u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430\u0448\u0435\u0439 \u0446\u0435\u043b\u044c\u044e \u0431\u044b\u043b\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 JavaScript \u0432\u0435\u0440\u0441\u0438\u044f TensorFlow \u2014 <a href=\"https:\/\/www.tensorflow.org\/js\" rel=\"nofollow\">TensorFlow.js<\/a>. \u0412 JavaScript \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u043d\u0435\u0435 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0435\u0449\u0435 \u043e\u0434\u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 <a href=\"https:\/\/www.tensorflow.org\/js\/tutorials\/conversion\/import_saved_model\" rel=\"nofollow\">tfjs_graph_model<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u044d\u0442\u0443 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044e, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f Python \u043f\u0430\u043a\u0435\u0442 tensorflowjs:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">pip install tensorflowjs --quiet<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u043c \u0444\u043e\u0440\u043c\u0430\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">%%bash  tensorflowjs_converter \\     --input_format=tf_saved_model \\     --output_format=tfjs_graph_model \\     exported\/ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8\/saved_model \\     exported_web\/ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0430\u043f\u043a\u0430 <code>exported_web<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 <code>.json<\/code> \u0444\u0430\u0439\u043b \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e\u0431 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u043c\u043e\u0434\u0435\u043b\u0438, \u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <code>.bin<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0435\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">exported_web \u2514\u2500\u2500 ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8     \u251c\u2500\u2500 group1-shard1of4.bin     \u251c\u2500\u2500 group1-shard2of4.bin     \u251c\u2500\u2500 group1-shard3of4.bin     \u251c\u2500\u2500 group1-shard4of4.bin     \u2514\u2500\u2500 model.json<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c <code>https:\/\/<\/code> \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u044b \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445 \u0438 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435, \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u043c JavaScript \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import pathlib  def get_folder_size(folder_path):     mB = 1000000     root_dir = pathlib.Path(folder_path)     sizeBytes = sum(f.stat().st_size for f in root_dir.glob('**\/*') if f.is_file())     return f'{sizeBytes\/\/mB} MB'  print(f'Original model size:      {get_folder_size(&quot;cache\/datasets\/ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8&quot;)}') print(f'Exported model size:      {get_folder_size(&quot;exported\/ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8&quot;)}') print(f'Exported WEB model size:  {get_folder_size(&quot;exported_web\/ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8&quot;)}')<\/code><\/pre>\n<p>  <\/p>\n<p><em>output \u2192<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Original model size:      31 MB Exported model size:      28 MB Exported WEB model size:  13 MB<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432\u0435\u0441\u0438\u0442 <code>13MB<\/code>, \u0447\u0442\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0437\u0436\u0435 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">import * as tf from '@tensorflow\/tfjs'; const model = await tf.loadGraphModel(modelURL);<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043c\u043e\u0439 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438. \u041d\u043e \u0443\u0436\u0435 \u0441\u0435\u0439\u0447\u0430\u0441, \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043a\u043e\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 TypeScript \u0432 <a href=\"https:\/\/github.com\/trekhleb\/links-detector\" rel=\"nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 links-detector<\/a> \u043d\u0430 GitHub.<\/p><\/blockquote>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u0440\u0435\u0448\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0447\u0430\u0442\u043d\u044b\u0445 \u0441\u0441\u044b\u043b\u043e\u043a. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u043e\u0431\u0443\u0447\u0438\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0443\u044e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u044b <code>https:\/\/<\/code> \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043a\u0430\u0434\u0440\u0430\u0445 \u0432\u0438\u0434\u0435\u043e-\u043f\u043e\u0442\u043e\u043a\u0430 \u0441 \u043a\u0430\u043c\u0435\u0440\u044b \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0430). \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 <code>tfjs_graph_model<\/code> \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0435\u0435 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432 JavaScript\/TypeScript \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/trekhleb.github.io\/links-detector\/\" rel=\"nofollow\"><strong>\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Links Detector<\/strong><\/a> \u0441\u043e \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0430 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u043e\u043d \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0438 \u0432 \u0432\u0430\u0448\u0435\u0439 \u043a\u043d\u0438\u0433\u0435 \u0438\u043b\u0438 \u0436\u0443\u0440\u043d\u0430\u043b\u0435.<\/p>\n<p>  <\/p>\n<p>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/trekhleb\/links-detector\/master\/articles\/printed_links_detection\/assets\/03-links-detector-demo.gif\" alt=\"Links Detector Demo\"><\/p>\n<p>  <\/p>\n<p>\u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/github.com\/trekhleb\/links-detector\" rel=\"nofollow\"><strong>\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u043c links-detector<\/strong><\/a> \u043d\u0430 GitHub, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<blockquote><p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <em>\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0439<\/em> \u0441\u0442\u0430\u0434\u0438\u0438 \u0438 \u0438\u043c\u0435\u0435\u0442 <a href=\"https:\/\/github.com\/trekhleb\/links-detector\/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement\" rel=\"nofollow\">\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043e\u043a \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439<\/a>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u043d\u0435\u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043b\u0438\u043a\u0432\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u0439\u0442\u0435 \u043e\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e\u0433\u043e <\/p><\/blockquote>\n<\/div>\n<p> \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\/530850\/\"> https:\/\/habr.com\/ru\/post\/530850\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/745\/b61\/01a\/745b6101a4bb0c212288c868617942b8.png\" alt=\"Links Detector Cover\"><\/p>\n<p>  <\/p>\n<h2 id=\"tldr\">TL;DR<\/h2>\n<p>  <\/p>\n<p><em>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0430\u0447\u043d\u0435\u043c \u0440\u0435\u0448\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0447\u0430\u0442\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0432 \u043a\u043d\u0438\u0433\u0430\u0445 \u0438\u043b\u0438 \u0436\u0443\u0440\u043d\u0430\u043b\u0430\u0445 \u043a\u043b\u0438\u043a\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u0430\u043c\u0435\u0440\u0443 \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0430.<\/em><\/p>\n<p>  <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/github.com\/tensorflow\/models\/tree\/master\/research\/object_detection\" rel=\"nofollow\">TensorFlow 2 Object Detection API<\/a> \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043c TensorFlow \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438 \u0433\u0430\u0431\u0430\u0440\u0438\u0442\u044b \u0441\u0442\u0440\u043e\u043a <code>https:\/\/<\/code> \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u0430\u0434\u0440\u0435 \u0432\u0438\u0434\u0435\u043e \u0438\u0437 \u043a\u0430\u043c\u0435\u0440\u044b \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0430).<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043a\u0441\u0442 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043f\u043e \u043f\u0440\u0430\u0432\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043e\u0442 <code>https:\/\/<\/code>, \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/tesseract.projectnaptha.com\/\" rel=\"nofollow\">Tesseract<\/a>. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 Tesseract \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u043c \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u043b\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 <a href=\"https:\/\/github.com\/trekhleb\/links-detector\" rel=\"nofollow\">links-detector repository<\/a> \u043d\u0430 GitHub.<\/p>\n<p>  <\/p>\n<blockquote><p><a href=\"https:\/\/trekhleb.github.io\/links-detector\/\" rel=\"nofollow\"><strong>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Links Detector<\/strong><\/a> \u0441\u043e \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p>  <a href=\"https:\/\/github.com\/trekhleb\/links-detector\" rel=\"nofollow\"><strong>\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 links-detector<\/strong><\/a> \u043d\u0430 GitHub \u0441 \u043f\u043e\u043b\u043d\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p><\/blockquote>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u0432 \u0438\u0442\u043e\u0433\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0447\u0430\u0442\u043d\u044b\u0445 \u0441\u0441\u044b\u043b\u043e\u043a:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/trekhleb\/links-detector\/master\/articles\/printed_links_detection\/assets\/03-links-detector-demo.gif\" alt=\"Links Detector Demo\"><\/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-314140","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/314140","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=314140"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/314140\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=314140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=314140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=314140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}