{"id":342143,"date":"2022-12-05T09:11:04","date_gmt":"2022-12-05T09:11:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=342143"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=342143","title":{"rendered":"<span>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e MediaPipe \u0432 Python<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c97\/7fd\/28a\/c977fd28a7f4573a8c056c6edd52f232.gif\" width=\"768\" height=\"432\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c97\/7fd\/28a\/c977fd28a7f4573a8c056c6edd52f232.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e \u0434\u0430\u043d\u043d\u044b\u043c CDC (<em>\u0426\u0435\u043d\u0442\u0440\u044b \u043f\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044e \u0438 \u043f\u0440\u043e\u0444\u0438\u043b\u0430\u043a\u0442\u0438\u043a\u0435 \u0437\u0430\u0431\u043e\u043b\u0435\u0432\u0430\u043d\u0438\u0439 \u0421\u0428\u0410<\/em>), \u201c\u043f\u043e \u043e\u0446\u0435\u043d\u043a\u0430\u043c, 1 \u0438\u0437 25 \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0445 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u0439 (18 \u043b\u0435\u0442 \u0438 \u0441\u0442\u0430\u0440\u0448\u0435) \u0441\u043e\u043e\u0431\u0449\u0430\u044e\u0442 \u043e \u0437\u0430\u0441\u044b\u043f\u0430\u043d\u0438\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u043e\u0436\u0434\u0435\u043d\u0438\u044f &#8230;\u201d.\u00a0\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f:\u00a0<em>\u201c&#8230; \u0441\u043e\u043d\u043d\u043e\u0435 \u0432\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043b\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 91 000 \u0434\u043e\u0440\u043e\u0436\u043d\u043e-\u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0441\u0448\u0435\u0441\u0442\u0432\u0438\u0439 &#8230;\u201d.<\/em>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u043e\u0447\u044c \u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443\u00a0<strong>\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f API-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Mediapipe \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f Face Mesh \u043d\u0430 Python<\/strong>.\u00a0\u042d\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u044e\u0442 \u0431\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e\u0442 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f. <\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/638d987561ecc8ef4a813fda\" data-style=\"\" id=\"638d987561ecc8ef4a813fda\" width=\"\"><\/div>\n<h2>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e MediaPipe \u0432 Python [TL; DR]<\/h2>\n<p>\u041d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0435 \u0432\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0442\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0438 \u0438\u0437\u043c\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u043c. \u0410\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0438\u0441\u0442 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0437\u0430\u0434\u0440\u0435\u043c\u0430\u0442\u044c \u0438\u0437-\u0437\u0430 \u0431\u0435\u0437\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 <strong>Face Mesh \u043e\u0442 Mediapipe<\/strong> \u043d\u0430 <strong>python<\/strong> \u0438 <strong>\u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u043e\u043d \u0433\u043b\u0430\u0437<\/strong>. \u041d\u0430\u0448\u0430 \u0446\u0435\u043b\u044c &#8212; \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0435 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0435\u0441\u043b\u0438 \u0438\u0445 \u0433\u043b\u0430\u0437\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u044b \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b:<\/p>\n<ol>\n<li>\n<p>\u0423\u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b \u0434\u043b\u044f \u0433\u043b\u0430\u0437 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<strong>\u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f Mediapipe Face Mesh \u043d\u0430 python<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0438 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0442\u0435\u0445\u043d\u0438\u043a\u0443\u00a0<strong>\u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u043d \u0433\u043b\u0430\u0437\u0430 (EAR)<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f\u00a0<strong>\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f<\/strong>\u00a0\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<strong>streamlit<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u00a0<strong>streamlit-webrtc<\/strong>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u043e\u0447\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \/ \u0430\u0443\u0434\u0438\u043e \u043f\u043e\u0442\u043e\u043a\u0438 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e \u0441\u0435\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0430\u0437\u0432\u0435\u0440\u043d\u0435\u043c<\/strong>\u00a0\u0435\u0433\u043e \u0432 \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0439 \u0441\u043b\u0443\u0436\u0431\u0435.<\/p>\n<\/li>\n<\/ol>\n<h2>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h2>\n<ol>\n<li>\n<p><a href=\"#1\" rel=\"noopener noreferrer nofollow\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0441\u043e\u043d\u043d\u043e\u0435 \u0432\u043e\u0436\u0434\u0435\u043d\u0438\u0435?<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#2\" rel=\"noopener noreferrer nofollow\">\u041d\u0430\u0448 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#3\" rel=\"noopener noreferrer nofollow\">\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0435\u0442\u043a\u0438 \u0433\u0440\u0430\u043d\u0435\u0439 MediaPipe \u0432 Python<\/a><\/p>\n<ol>\n<li>\n<p><a href=\"#3.1.\" rel=\"noopener noreferrer nofollow\">\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0441 \u043b\u0438\u0446\u0435\u0432\u043e\u0439 \u0441\u0435\u0442\u043a\u043e\u0439<\/a><\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p><a href=\"#4\" rel=\"noopener noreferrer nofollow\">\u041c\u0435\u0442\u043e\u0434 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u043d \u0433\u043b\u0430\u0437\u0430 (EAR)<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#5\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u043a\u043e\u0434\u0443 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u043d\u0430 Python<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#6\" rel=\"noopener noreferrer nofollow\">Summary<\/a><\/p>\n<\/li>\n<\/ol>\n<p><a class=\"anchor\" name=\"1\" id=\"1\"><\/a><\/p>\n<h2>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0441\u043e\u043d\u043d\u043e\u0435 \u0432\u043e\u0436\u0434\u0435\u043d\u0438\u0435?<\/h2>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/15f\/e97\/976\/15fe979766613155e7a5950d71356335.gif\" width=\"600\" height=\"338\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/15f\/e97\/976\/15fe979766613155e7a5950d71356335.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0435 \u0432\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0442\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0438 \u0438\u0437\u043c\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u043c. CDC \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u043a\u0430\u043a \u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435 \u0432\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0438 \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0438\u043b\u0438 \u0443\u0441\u0442\u0430\u043b\u043e\u0441\u0442\u0438. \u0418\u0437-\u0437\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u043b\u0430 \u0443 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0447\u0430\u0442\u044c \u0441\u043b\u0438\u043f\u0430\u0442\u044c\u0441\u044f \u0433\u043b\u0430\u0437\u0430, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u044c \u0438 \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0437\u0430\u0441\u043d\u0443\u0442\u044c \u0437\u0430 \u0440\u0443\u043b\u0435\u043c.<\/p>\n<p><strong>\u041d\u0430\u0448\u0430 \u0446\u0435\u043b\u044c &#8212; \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043d\u044b\u0445 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0435\u0441\u043b\u0438 \u0438\u0445 \u0433\u043b\u0430\u0437\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u044b \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/strong><\/p>\n<p><a class=\"anchor\" name=\"2\" id=\"2\"><\/a><\/p>\n<h2>\u041d\u0430\u0448 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f<\/h2>\n<p><strong><em>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f?<\/em><\/strong><\/p>\n<p>\u0418\u043c\u0435\u044f \u0432 \u0432\u0438\u0434\u0443 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e:<\/p>\n<ol>\n<li>\n<p><strong>\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u0430\u043c\u0435\u0440\u0435.<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043b\u0438\u0446\u0435\u0432\u044b\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432.<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u201c<em>\u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0435 \u0432\u0435\u043a\u0438. \u201d<\/em><\/strong><\/p>\n<\/li>\n<\/ol>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<ul>\n<li>\n<p><em>\u0414\u043b\u044f \u043f\u0443\u043d\u043a\u0442\u0430 1:<\/em>\u00a0\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u043a\u0430\u043c\u0435\u0440\u0443, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0443\u044e \u043a \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435.\u00a0\u0412 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0431-\u043a\u0430\u043c\u0435\u0440\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043f\u0443\u043d\u043a\u0442\u0430 2: \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0440\u0435\u0448\u0435\u043d\u0438\u044f <strong>Mediapipe Face Mesh<\/strong> \u043d\u0430 python.<\/p>\n<\/li>\n<li>\n<p><em>\u0414\u043b\u044f \u043f\u0443\u043d\u043a\u0442\u0430 3:<\/em>\u00a0\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u043d\u043e \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439\u00a0<strong>\u0421\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u043e\u043d \u0433\u043b\u0430\u0437<\/strong>\u00a0(EAR) \u043c\u0435\u0442\u043e\u0434, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432\u00a0<a href=\"http:\/\/vision.fe.uni-lj.si\/cvww2016\/proceedings\/papers\/05.pdf\" rel=\"noopener noreferrer nofollow\"><u>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0440\u0433\u0430\u043d\u0438\u044f \u0433\u043b\u0430\u0437 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043b\u0438\u0446\u0435\u0432\u044b\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432<\/u><\/a>.<\/p>\n<\/li>\n<\/ul>\n<p>(\u041c\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u043f\u0443\u043d\u043a\u0442\u044b 2 \u0438 3 \u043f\u043e\u0437\u0436\u0435 \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435.)<\/p>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435 \u0441\u0442\u0430\u0442\u044c\u0435 \u0430\u0432\u0442\u043e\u0440\u044b \u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u0441\u0432\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a\u00a0<em>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043c\u0438\u0433\u0430\u043d\u0438\u044f<\/em>.\u00a0\u041c\u043e\u0440\u0433\u0430\u043d\u0438\u0435 \u0433\u043b\u0430\u0437 &#8212; \u044d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f.\u00a0\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 SVM \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0440\u0433\u0430\u043d\u0438\u044f \u0433\u043b\u0430\u0437 \u043a\u0430\u043a \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 EAR \u0432 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043e\u043a\u043d\u0435.<\/p>\n<p><strong><em>\u041a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u044c?<\/em><\/strong><\/p>\n<p>\u041c\u044b \u043d\u0435 \u0441\u0442\u0440\u0435\u043c\u0438\u043c\u0441\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u201c\u043c\u0438\u0433\u0430\u043d\u0438\u044f\u201d, \u0430 \u0441\u043a\u043e\u0440\u0435\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u044b \u0433\u043b\u0430\u0437\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442.\u00a0\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u0434\u0430\u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u0430\u043a\u043e\u0435-\u043b\u0438\u0431\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435.\u00a0\u041c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435\u043c,\u00a0<strong><em>\u201c\u041d\u0430\u0448\u0438 \u0433\u043b\u0430\u0437\u0430 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u044e\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0447\u0443\u0432\u0441\u0442\u0432\u0443\u0435\u043c \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u044c\u201d.<\/em><\/strong><\/p>\n<p><strong><em>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u043b\u0438 \u0433\u043b\u0430\u0437\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c\u0438 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/em><\/strong><\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0437\u0430\u043a\u0440\u044b\u0442\u044b \u0433\u043b\u0430\u0437\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0<strong>\u0421\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u043e\u043d \u0433\u043b\u0430\u0437<\/strong>\u00a0(EAR) \u0444\u043e\u0440\u043c\u0443\u043b\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8d7\/e02\/003\/8d7e02003a459ed5c2db6293a1811774.png\" width=\"1024\" height=\"223\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8d7\/e02\/003\/8d7e02003a459ed5c2db6293a1811774.png\"\/><figcaption><\/figcaption><\/figure>\n<p><em>\u0424\u043e\u0440\u043c\u0443\u043b\u0430 EAR \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0433\u043b\u0430\u0437.<\/em>  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1ac\/e57\/7e0\/1ace577e0f0039febe0c48f51f78b6c1.png\" width=\"1024\" height=\"395\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1ac\/e57\/7e0\/1ace577e0f0039febe0c48f51f78b6c1.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0430\u0448 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \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><strong><em>\u201c\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 EAR \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u0430\u0434\u0440\u0430\u0445.\u00a0\u0415\u0441\u043b\u0438 \u0433\u043b\u0430\u0437\u0430 \u0431\u044b\u043b\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u044b \u0434\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0437\u0430\u0434\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043c\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u043c \u0441\u0438\u0433\u043d\u0430\u043b \u0442\u0440\u0435\u0432\u043e\u0433\u0438 \u201d.<\/em><\/strong><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f10\/0d1\/4ea\/f100d14ea3ada320d633e83e1d88847e.png\" width=\"635\" height=\"1024\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f10\/0d1\/4ea\/f100d14ea3ada320d633e83e1d88847e.png\"\/><figcaption><\/figcaption><\/figure>\n<ol>\n<li>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u0434\u0432\u0430 \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0441\u0447\u0435\u0442\u0447\u0438\u043a.<\/p>\n<ol>\n<li>\n<p><code>EAR_thresh<\/code>:<em>\u00a0<\/em>\u041f\u043e\u0440\u043e\u0433\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 EAR \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430.<\/p>\n<\/li>\n<li>\n<p><code>D_TIME<\/code>: \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430 \u0434\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0435\u0433\u043e \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c\u00a0<code>EAR &lt; EAR_THRESH.<\/code>\u00a0<\/p>\n<\/li>\n<li>\n<p><em>WAIT_TIME:\u00a0<\/em>\u0427\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043f\u0440\u043e\u0448\u043b\u043e \u043b\u0438 \u0432\u0440\u0435\u043c\u044f \u0441\u00a0<code>EAR &lt; EAR_THRESH<\/code>\u00a0\u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u043f\u0440\u0435\u0434\u0435\u043b.<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f (\u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445) \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e\u00a0<code>t1<\/code>\u00a0\u0438 \u0441\u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043a\u0430\u0434\u0440.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c\u00a0<code>frame<\/code><strong>\u00a0<\/strong>\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 <strong>Mediapipe Face Mesh<\/strong> \u043d\u0430 python.<\/p>\n<\/li>\n<li>\n<p>\u041c\u044b \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 (<strong>P<sub>i<\/sub><\/strong>) \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b \u0434\u043b\u044f \u0433\u043b\u0430\u0437, \u0435\u0441\u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b.\u00a0\u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u0431\u0440\u043e\u0441\u00a0<code>t1\u00a0<\/code>\u0438\u00a0<code>D_TIME\u00a0(D_TIME<\/code>\u00a0\u0442\u0430\u043a\u0436\u0435 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0434\u0435\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u043c).<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b, \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0435\u00a0<strong>EAR <\/strong>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u0433\u043b\u0430\u0437 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432 \u0434\u043b\u044f \u0433\u043b\u0430\u0437.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0430\u044f\u00a0<code>EAR\u00a0&lt;\u00a0EAR_THRESH<\/code>, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c\u00a0<code>t2<\/code>\u00a0\u0438\u00a0<code>t1<\/code>\u00a0\u0414\u043b\u044f\u00a0<code>D_TIME<\/code>.\u00a0\u0417\u0430\u0442\u0435\u043c \u0441\u0431\u0440\u043e\u0441\u044c\u0442\u0435\u00a0<code>t1\u00a0<\/code>\u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u0430\u0434\u0440\u0430 \u043a\u0430\u043a\u00a0<code>t2<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u00a0<code>D_TIME >= WAIT_TIME<\/code>, \u043c\u044b\u00a0<strong>\u043f\u043e\u0434\u043d\u0438\u043c\u0438\u0442\u0435 \u0442\u0440\u0435\u0432\u043e\u0433\u0443\u00a0<\/strong>\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u0435 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043a\u0430\u0434\u0440\u0443.<\/p>\n<\/li>\n<\/ol>\n<p><a class=\"anchor\" name=\"3\" id=\"3\"><\/a><\/p>\n<h2>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0435\u0442\u043a\u0438 \u0433\u0440\u0430\u043d\u0435\u0439 MediaPipe \u0432 Python<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e Mediapipe, \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u043d\u0430\u0448\u0438\u043c\u00a0<a href=\"https:\/\/learnopencv.com\/introduction-to-mediapipe\/\" rel=\"noopener noreferrer nofollow\"><u>\u0432\u0432\u043e\u0434\u043d\u044b\u0439 \u0443\u0440\u043e\u043a \u043f\u043e Mediapipe<\/u><\/a>, \u0433\u0434\u0435 \u043c\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b Mediapipe.<\/p>\n<p><strong>Mediapipe \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u00a0<\/strong><a href=\"https:\/\/google.github.io\/mediapipe\/solutions\/face_mesh.html\" rel=\"noopener noreferrer nofollow\"><strong><u>\u041a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u043b\u0438\u0446\u0435\u0432\u043e\u0439 \u0441\u0435\u0442\u043a\u0438<\/u><\/strong><\/a><strong>\u00a0\u043a\u0430\u043a:<\/strong><\/p>\n<blockquote>\n<p><em>\u201c\u041d\u0430\u0448 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 ML \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432\u043c\u0435\u0441\u0442\u0435: \u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043f\u043e\u043b\u043d\u044b\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043b\u0438\u0446\u0430, \u0438 3D-\u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430 \u043b\u0438\u0446\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u044d\u0442\u0438\u043c\u0438 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e 3D-\u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438.\u00a0\u0422\u043e\u0447\u043d\u0430\u044f \u043e\u0431\u0440\u0435\u0437\u043a\u0430 \u043b\u0438\u0446\u0430 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u0432 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f\u0445 \u043a \u0434\u0430\u043d\u043d\u044b\u043c, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0430\u0444\u0444\u0438\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0435 \u0438\u0437 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043e\u0432, \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430.\u00a0\u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0435\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u0432\u043e\u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0446\u0438\u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.\u00a0\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0435 \u043f\u043e\u0441\u0435\u0432\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432 \u043b\u0438\u0446\u0430, \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043a\u0430\u0434\u0440\u0435, \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043b\u0438\u0446\u0430, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440 \u043b\u0438\u0446\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043b\u0438\u0446\u0430 \u201d.<\/em><\/p>\n<\/blockquote>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3da\/0a1\/a8d\/3da0a1a8d29986cb8d62dec0af5c5228.gif\" width=\"300\" height=\"564\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3da\/0a1\/a8d\/3da0a1a8d29986cb8d62dec0af5c5228.gif\"\/><figcaption><\/figcaption><\/figure>\n<p><em>\u041a\u0440\u0430\u0441\u043d\u044b\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043e\u0431\u0440\u0435\u0437\u0430\u043d\u043d\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430, \u043a\u0440\u0430\u0441\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442<\/em><strong><em>\u00a0468<\/em><\/strong><em>\u00a0\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432 \u0432 3D, \u0430 \u0437\u0435\u043b\u0435\u043d\u044b\u0435 \u043b\u0438\u043d\u0438\u0438, \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0438\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b, \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442 \u043a\u043e\u043d\u0442\u0443\u0440\u044b \u0432\u043e\u043a\u0440\u0443\u0433 \u0433\u043b\u0430\u0437, \u0431\u0440\u043e\u0432\u0435\u0439, \u0433\u0443\u0431 \u0438 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0446\u0430.<\/em><\/p>\n<p><em>Mediapipe &#8212; \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.\u00a0\u0412\u0430\u0441 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0435 \u043d\u0430\u0448\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u0431\u043b\u043e\u0433\u0435, \u0433\u0434\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 Face Mesh \u0434\u043b\u044f<\/em><a href=\"https:\/\/learnopencv.com\/create-snapchat-instagram-filters-using-mediapipe\/\" rel=\"noopener noreferrer nofollow\"><em><u>\u00a0\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 Snapchat \u0438 Instagram \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Mediapipe<\/u><\/em><\/a><em>.<\/em><\/p>\n<p>\u041a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435, \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043b\u044f\u00a0<strong>\u0441\u0435\u0442\u043a\u0438 \u043b\u0438\u0446<\/strong>\u00a0\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u00a0<strong><em>468<\/em><\/strong>\u00a0\u0442\u043e\u0447\u0435\u043a \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430 \u043d\u0430 \u043b\u0438\u0446\u0435.<\/p>\n<p>\u041d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u0442\u043e\u0447\u0435\u043a.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/75a\/979\/6f2\/75a9796f28009fff43b14b9aa43e33c1.png\" alt=\"\" title=\"\" width=\"1024\" height=\"1024\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/75a\/979\/6f2\/75a9796f28009fff43b14b9aa43e33c1.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a:\u00a0<a href=\"https:\/\/github.com\/google\/mediapipe\/tree\/master\/mediapipe\/modules\/face_geometry\/data\" rel=\"noopener noreferrer nofollow\"><u>canonical_face_model_uv_visualization<\/u><\/a>  <\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/strong>\u00a0\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0441\u043d\u044f\u0442\u044b\u0435 \u043a\u0430\u043c\u0435\u0440\u043e\u0439, \u043f\u0435\u0440\u0435\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438.\u00a0\u0418\u0442\u0430\u043a, \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b (\u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0432\u044b\u0448\u0435) \u0432 \u0433\u043b\u0430\u0437\u0443 (\u043e\u0431\u043b\u0430\u0441\u0442\u0438) \u0441\u043b\u0435\u0432\u0430 \u043e\u0442 \u0432\u0430\u0441 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u043e\u0433\u043e \u0433\u043b\u0430\u0437\u0430 \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0444\u043e\u043a\u0443\u0441\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043d\u0430\u00a0<strong><em>\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f<\/em><\/strong>, \u0438\u0437\u00a0<strong>468<\/strong>\u00a0\u0442\u043e\u0447\u0435\u043a \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0447\u043a\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c \u0433\u043b\u0430\u0437.\u00a0\u041e\u0431\u043b\u0430\u0441\u0442\u0438 \u0433\u043b\u0430\u0437 \u0438\u043c\u0435\u044e\u0442 32 \u0442\u043e\u0447\u043a\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430 (\u043f\u043e 16 \u0442\u043e\u0447\u0435\u043a \u0432 \u043a\u0430\u0436\u0434\u043e\u0439).<em>\u00a0<\/em><strong>\u0414\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f EAR \u043d\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e 12 \u0442\u043e\u0447\u0435\u043a (\u043f\u043e 6 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0433\u043b\u0430\u0437\u0430).<\/strong><\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u0432\u044b\u0448\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u044d\u0442\u0430\u043b\u043e\u043d\u0430, \u0432\u044b\u0431\u0440\u0430\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435\u00a0<strong>12 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432<\/strong>:<\/p>\n<ol>\n<li>\n<p>\u0414\u043b\u044f\u00a0<strong>\u043b\u0435\u0432\u043e\u0433\u043e \u0433\u043b\u0430\u0437\u0430<\/strong>:\u00a0<code>[362, 385, 387, 263, 373, 380]<\/code><\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f\u00a0<strong>\u043f\u0440\u0430\u0432\u043e\u0433\u043e \u0433\u043b\u0430\u0437\u0430<\/strong>:\u00a0<code>[33, 160, 158, 133, 153, 144]<\/code><\/p>\n<\/li>\n<\/ol>\n<p>\u0412\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435:\u00a0<strong><em>P<sub>\u00a01<\/sub>, P<sub>\u00a02<\/sub>, P<sub>\u00a03<\/sub>, P<sub>\u00a04<\/sub>, P<sub>\u00a05<\/sub>, P<sub>\u00a06<\/sub>\u00a0<\/em><\/strong><\/p>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u0442\u043e\u0447\u043a\u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438.\u00a0\u041e\u043d\u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c face mesh.\u00a0\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b\u00a0<em>x<\/em>,\u00a0<em>y<\/em>\u00a0(\u0438\u00a0<em>z<\/em>), \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044e \u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435.<\/p>\n<\/blockquote>\n<p>\u041a\u0430\u043a \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430, \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u00a0<strong><em>\u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u043b\u0438\u0446<\/em><\/strong>\u00a0\u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043c\u043e\u0434\u0435\u043b\u044c\u044e\u00a0<strong><em>\u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u043b\u0438\u0446\u0435\u0432\u044b\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432<\/em><\/strong>.\u00a0\u0414\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u043b\u0438\u0446 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u00a0<em>\u043c\u043e\u0434\u0435\u043b\u044c BlazeFace, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u043c\u0435\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u0430.<\/em><\/p>\n<p>\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u043b\u0438\u0446 &#8212; \u043e\u0447\u0435\u043d\u044c \u0433\u043e\u0440\u044f\u0447\u0430\u044f \u0442\u0435\u043c\u0430 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f.\u00a0\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u043e\u0447\u044c \u043d\u0430\u0448\u0438\u043c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c \u043b\u0435\u0433\u043a\u043e \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043e\u0447\u0435\u043d\u044c\u00a0<a href=\"https:\/\/learnopencv.com\/what-is-face-detection-the-ultimate-guide\/\" rel=\"noopener noreferrer nofollow\"><strong><em><u>\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044e \u043b\u0438\u0446<\/u><\/em><\/strong><\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0433\u0438\u0433\u0430\u043d\u0442\u044b \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435.<\/p>\n<p><a class=\"anchor\" name=\"3.1.\" id=\"3.1.\"><\/a><\/p>\n<h3>\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0441 \u043b\u0438\u0446\u0435\u0432\u043e\u0439 \u0441\u0435\u0442\u043a\u043e\u0439<\/h3>\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 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u044b\u0432\u043e\u0434 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c\u00a0<strong>\u0441\u0435\u0442\u043a\u0438 \u043b\u0438\u0446<\/strong>\u00a0\u0438 \u043d\u0430\u043d\u0435\u0441\u0442\u0438 \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a \u0442\u043e\u0447\u043a\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430 \u043b\u0438\u0446\u0430.  <\/p>\n<pre><code class=\"python\">import cv2 import numpy as np import matplotlib.pyplot as plt import mediapipe as mp   mp_facemesh = mp.solutions.face_mesh mp_drawing  = mp.solutions.drawing_utils denormalize_coordinates = mp_drawing._normalized_to_pixel_coordinates   %matplotlib inline<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b (\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435) \u0442\u043e\u0447\u043a\u0438 \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u0433\u043b\u0430\u0437.  <\/p>\n<pre><code class=\"python\"># Landmark points corresponding to left eye all_left_eye_idxs = list(mp_facemesh.FACEMESH_LEFT_EYE) # flatten and remove duplicates all_left_eye_idxs = set(np.ravel(all_left_eye_idxs))    # Landmark points corresponding to right eye all_right_eye_idxs = list(mp_facemesh.FACEMESH_RIGHT_EYE) all_right_eye_idxs = set(np.ravel(all_right_eye_idxs))   # Combined for plotting - Landmark points for both eye all_idxs = all_left_eye_idxs.union(all_right_eye_idxs)   # The chosen 12 points:   P1,  P2,  P3,  P4,  P5,  P6 chosen_left_eye_idxs  = [362, 385, 387, 263, 373, 380] chosen_right_eye_idxs = [33,  160, 158, 133, 153, 144] all_chosen_idxs = chosen_left_eye_idxs + chosen_right_eye_idxs<\/code><\/pre>\n<p> \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c API \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432 \u043d\u0430 \u043e\u0431\u0440\u0430\u0437\u0446\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<strong>:<\/strong>  <\/p>\n<pre><code class=\"python\"># load the image image = cv2.imread(r\"test-open-eyes.jpg\") image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # convert to RGB image = np.ascontiguousarray(image) imgH, imgW, _ = image.shape   plt.imshow(image)<\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/3d3\/8d9\/64d\/3d38d964d3abeed877cbb2ad7b822a98.jpeg\" width=\"500\" height=\"750\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3d3\/8d9\/64d\/3d38d964d3abeed877cbb2ad7b822a98.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u00a0<strong>Face Mesh<\/strong>\u00a0graph &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440  \u201c<code>with<\/code>\u201d.\u00a0\u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u043a\u0430\u043a:<\/p>\n<ol>\n<li>\n<p><code>static_image_mode<\/code>: \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a\u0430\u043a \u043f\u0430\u043a\u0435\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0435\u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438\u043b\u0438 \u0432\u0438\u0434\u0435\u043e\u043f\u043e\u0442\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p><code>max_num_faces<\/code>: \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043b\u0438\u0446.<\/p>\n<\/li>\n<li>\n<p><code>refine_landmarks<\/code>: \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043b\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0442\u043e\u0447\u043d\u044f\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432 \u0432\u043e\u043a\u0440\u0443\u0433 \u0433\u043b\u0430\u0437 \u0438 \u0433\u0443\u0431 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b \u0432\u043e\u043a\u0440\u0443\u0433 \u0440\u0430\u0434\u0443\u0436\u043d\u043e\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><code>min_detection_confidence<\/code>: \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u043d\u043e\u0441\u0442\u0438\u00a0<code>([0.0, 1.0])<\/code>\u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u043b\u0438\u0446, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u043c.<\/p>\n<\/li>\n<li>\n<p><code>min_tracking_confidence<\/code>: \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u043d\u043e\u0441\u0442\u0438\u00a0<code>([0.0, 1.0])\u00a0<\/code>\u0434\u043b\u044f \u043b\u0438\u0446\u0435\u0432\u044b\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c\u0441\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0435\u043d\u043d\u044b\u043c\u0438.<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\"># Running inference using static_image_mode  with mp_facemesh.FaceMesh(     static_image_mode=True,         # Default=False     max_num_faces=1,                # Default=1     refine_landmarks=False,         # Default=False     min_detection_confidence=0.5,   # Default=0.5     min_tracking_confidence= 0.5,   # Default=0.5 ) as face_mesh:           results = face_mesh.process(image)   # Indicates whether any detections are available or not. print(bool(results.multi_face_landmarks))<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430, \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u00a0<code>min_tracking_confidence<\/code>.\u00a0\u041a\u0430\u043a \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u0448\u0435, \u044d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0432 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u043c \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432.\u00a0\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0430\u0445 \u043c\u0435\u0436\u0434\u0443 \u043a\u0430\u0434\u0440\u0430\u043c\u0438, \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b\u00a0<em>\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u043b\u0438\u0446\u0430, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043b\u0438\u0446\u0430.\u00a0<\/em>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u044d\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u0430.<\/p>\n<p>\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 &#8212; \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f, \u0438 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0431\u044b\u043b\u0438 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442\u044b \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0443\u0441\u043f\u0435\u0445\u0438.\u00a0\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0431 \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435, \u043d\u0435 \u0432\u043e\u043b\u043d\u0443\u0439\u0442\u0435\u0441\u044c, \u043c\u044b \u0432\u0430\u0441 \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u043c\u0441\u044f.\u00a0\u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u043b\u044f \u0432\u0430\u0441 \u0441\u0435\u0440\u0438\u044f \u0441\u0442\u0430\u0442\u0435\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0447\u0435\u0442\u043a\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f,\u00a0<a href=\"https:\/\/learnopencv.com\/the-complete-guide-to-object-tracking-in-computer-vision\/\" rel=\"noopener noreferrer nofollow\"><strong><em><u>\u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432?<\/u><\/em><\/strong><\/a><\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e, \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u043b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f.\u00a0\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 &#8212; \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430\u043c.\u00a0\u041c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0438\u0446 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b \u043f\u043e \u0432\u0441\u0435\u043c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c \u043b\u0438\u0446\u0430\u043c.\u00a0<code>results.multi_face_landmarks<\/code>\u041e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439\u00a0<em>\u0441\u043f\u0438\u0441\u043e\u043a<\/em>.\u00a0\u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432 \u0434\u043b\u044f \u043b\u0438\u0446\u0430.\u00a0\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043b\u0438\u043d\u0430 \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442\u00a0<code>max_num_faces\u00a0<\/code>\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430 (\u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043b\u0438\u0446\u0430), \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0<code>.landmark<\/code>\u0430\u0442\u0440\u0438\u0431\u0443\u0442<em>.\u00a0<\/em>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u0443\u043c\u0430\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c \u043a\u0430\u043a \u043e\u00a0<strong><em>\u0441\u043f\u0438\u0441\u043a\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439.<\/em><\/strong>\u042d\u0442\u043e\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c \u043f\u0435\u0440\u0432\u043e\u0439 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043b\u0438\u0446\u0430.<\/p>\n<pre><code class=\"python\">landmark_0 = results.multi_face_landmarks[0].landmark[0] print(landmark_0)   landmark_0_x = landmark_0.x * imgW  landmark_0_y = landmark_0.y * imgH landmark_0_z = landmark_0.z * imgW # according to documentation   print() print(\"X:\", landmark_0_x) print(\"Y:\", landmark_0_y) print(\"Z:\", landmark_0_z)   print() print(\"Total Length of '.landmark':\", len(results.multi_face_landmarks[0].landmark)) <\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0432\u043e\u0434:  <\/p>\n<pre><code class=\"python\">x: 0.5087572336196899 y: 0.5726696848869324 z: -0.03815639764070511   X: 254.37861680984497 Y: 429.5022636651993 Z: -19.078198820352554   Total Length of '.landmark': 468<\/code><\/pre>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b.\u00a0\u041c\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ol>\n<li>\n<p>\u0412\u0441\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<code>drawing_utils<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b \u0434\u043b\u044f \u0433\u043b\u0430\u0437.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b \u0434\u043b\u044f \u0433\u043b\u0430\u0437.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"python\">def plot(     *,     img_dt,     img_eye_lmks=None,     img_eye_lmks_chosen=None,     face_landmarks=None,     ts_thickness=1,     ts_circle_radius=2,     lmk_circle_radius=3,     name=\"1\", ):     # For plotting Face Tessellation     image_drawing_tool = img_dt             # For plotting all eye landmarks     image_eye_lmks = img_dt.copy() if img_eye_lmks is None else img_eye_lmks           # For plotting chosen eye landmarks     img_eye_lmks_chosen = img_dt.copy() if img_eye_lmks_chosen is None else img_eye_lmks_chosen       # Initializing drawing utilities for plotting face mesh tessellation     connections_drawing_spec = mp_drawing.DrawingSpec(         thickness=ts_thickness,          circle_radius=ts_circle_radius,          color=(255, 255, 255)     )       # Initialize a matplotlib figure.     fig = plt.figure(figsize=(20, 15))     fig.set_facecolor(\"white\")       # Draw landmarks on face using the drawing utilities.     mp_drawing.draw_landmarks(         image=image_drawing_tool,         landmark_list=face_landmarks,         connections=mp_facemesh.FACEMESH_TESSELATION,         landmark_drawing_spec=None,         connection_drawing_spec=connections_drawing_spec,     )       # Get the object which holds the x, y, and z coordinates for each landmark     landmarks = face_landmarks.landmark       # Iterate over all landmarks.     # If the landmark_idx is present in either all_idxs or all_chosen_idxs,     # get the denormalized coordinates and plot circles at those coordinates.       for landmark_idx, landmark in enumerate(landmarks):         if landmark_idx in all_idxs:             pred_cord = denormalize_coordinates(landmark.x,                                                  landmark.y,                                                  imgW, imgH)             cv2.circle(image_eye_lmks,                         pred_cord,                         lmk_circle_radius,                         (255, 255, 255),                         -1                        )           if landmark_idx in all_chosen_idxs:             pred_cord = denormalize_coordinates(landmark.x,                                                  landmark.y,                                                  imgW, imgH)             cv2.circle(img_eye_lmks_chosen,                         pred_cord,                         lmk_circle_radius,                         (255, 255, 255),                         -1                        )       # Plot post-processed images     plt.subplot(1, 3, 1)     plt.title(\"Face Mesh Tessellation\", fontsize=18)     plt.imshow(image_drawing_tool)     plt.axis(\"off\")       plt.subplot(1, 3, 2)     plt.title(\"All eye landmarks\", fontsize=18)     plt.imshow(image_eye_lmks)     plt.axis(\"off\")       plt.subplot(1, 3, 3)     plt.imshow(img_eye_lmks_chosen)     plt.title(\"Chosen landmarks\", fontsize=18)     plt.axis(\"off\")     plt.show()     plt.close()     return<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u043d\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e \u043f\u043e \u0441\u043f\u0438\u0441\u043a\u0443 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0439.  <\/p>\n<pre><code class=\"python\"># If detections are available. if results.multi_face_landmarks:           # Iterate over detections of each face. Here, we have max_num_faces=1,      # So there will be at most 1 element in      # the 'results.multi_face_landmarks' list                 # Only one iteration is performed.       for face_id, face_landmarks in enumerate(results.multi_face_landmarks):             _ = plot(img_dt=image.copy(), face_landmarks=face_landmarks)<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f2b\/6c7\/1d8\/f2b6c71d8236bbb519d00c876d284eff.png\" width=\"1024\" height=\"423\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f2b\/6c7\/1d8\/f2b6c71d8236bbb519d00c876d284eff.png\"\/><figcaption><\/figcaption><\/figure>\n<p><a class=\"anchor\" name=\"4\" id=\"4\"><\/a><\/p>\n<h2>\u041c\u0435\u0442\u043e\u0434 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u043d \u0433\u043b\u0430\u0437\u0430 (EAR)<\/h2>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043c\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043b\u0438 \u0448\u0430\u0433\u0438 \u0434\u043b\u044f\u00a0<strong><em>\u043f\u0443\u043d\u043a\u0442 2\u00a0<\/em><\/strong>\u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f.\u00a0\u0412 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043c\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043c\u00a0<strong><em>\u041f\u0443\u043d\u043a\u0442 3<\/em>:<\/strong>\u0424\u043e\u0440\u043c\u0443\u043b\u0430 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u043d \u0433\u043b\u0430\u0437, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0432 \u0441\u0442\u0430\u0442\u044c\u0435\u00a0<a href=\"http:\/\/vision.fe.uni-lj.si\/cvww2016\/proceedings\/papers\/05.pdf\" rel=\"noopener noreferrer nofollow\"><u>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0440\u0433\u0430\u043d\u0438\u044f \u0433\u043b\u0430\u0437 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043b\u0438\u0446\u0435\u0432\u044b\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432<\/u><\/a>.<\/p>\n<ol>\n<li>\n<p><em>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 Mediapipe Face Mesh \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445\u00a0<\/em><strong><em>\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0433\u043b\u0430\u0437<\/em><\/strong><em>\u00a0(\u0422\u043e\u0447\u043a\u0438\u00a0<\/em><strong><em>P<sub>1<\/sub><\/em><\/strong><em>\u00a0\u2013\u00a0<\/em><strong><em>P<sub>6<\/sub><\/em><\/strong><em>\u00a0\u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043d\u0438\u0436\u0435).<\/em><\/p>\n<\/li>\n<li>\n<p><em>\u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0442\u043e\u0447\u0435\u043a\u00a0<\/em><strong><em>\u0421\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u043e\u043d \u0433\u043b\u0430\u0437\u0430 (EAR) \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0441\u043e\u0442\u043e\u0439 \u0438 \u0448\u0438\u0440\u0438\u043d\u043e\u0439 \u0433\u043b\u0430\u0437\u0430.<\/em><\/strong><\/p>\n<\/li>\n<\/ol>\n<blockquote>\n<p><em>EAR \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u043c, \u043a\u043e\u0433\u0434\u0430 \u0433\u043b\u0430\u0437 \u043e\u0442\u043a\u0440\u044b\u0442, \u0438 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0430\u0435\u0442\u0441\u044f \u043a \u043d\u0443\u043b\u044e, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u0433\u043b\u0430\u0437\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u043c, \u0430 \u043f\u043e\u0437\u0430 \u0433\u043e\u043b\u043e\u0432\u044b \u043d\u0435\u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0430. \u0421\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u043e\u043d \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0433\u043b\u0430\u0437\u0430 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u0443 \u0440\u0430\u0437\u043d\u044b\u0445 \u043b\u044e\u0434\u0435\u0439. \u041e\u043d \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u043d\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435\u043d \u043a \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u043c\u0443 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0443 \u043b\u0438\u0446\u0430 \u0432 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u043e\u0440\u0433\u0430\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u043e\u0438\u043c\u0438 \u0433\u043b\u0430\u0437\u0430\u043c\u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e, EAR \u043e\u0431\u043e\u0438\u0445 \u0433\u043b\u0430\u0437 \u0443\u0441\u0440\u0435\u0434\u043d\u044f\u0435\u0442\u0441\u044f.<\/em><\/p>\n<\/blockquote>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f6a\/cfd\/669\/f6acfd66944d68b4aa09cd7c5e793e7d.png\" width=\"1024\" height=\"591\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f6a\/cfd\/669\/f6acfd66944d68b4aa09cd7c5e793e7d.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>\u041d\u0430\u0432\u0435\u0440\u0445:<\/strong>\u00a0\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0439\u0442\u0435 \u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0439\u0442\u0435 \u0433\u043b\u0430\u0437\u0430 \u0441 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430\u043c\u0438\u00a0<strong>P<sub>i<\/sub><\/strong>.<br \/><strong>\u0421\u043d\u0438\u0437\u0443:<\/strong>\u00a0\u0421\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u043e\u043d \u0433\u043b\u0430\u0437, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0435 \u0434\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u0430\u0434\u0440\u043e\u0432 \u0432\u0438\u0434\u0435\u043e\u0440\u044f\u0434\u0430.\u00a0\u041f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u043d\u043e \u043c\u0438\u0433\u0430\u043d\u0438\u0435.<\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u043e\u043d \u0433\u043b\u0430\u0437 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0433\u043b\u0430\u0437\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/448\/add\/956\/448add956d1dc8eaab85436c401fd95e.png\" width=\"1024\" height=\"469\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/448\/add\/956\/448add956d1dc8eaab85436c401fd95e.png\"\/><figcaption><\/figcaption><\/figure>\n<p><code>||<\/code>\u00a0\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u00a0<strong>\u043d\u043e\u0440\u043c\u0443 L2<\/strong>\u00a0\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0430\u043c\u0438.<\/p>\n<p>\u0414\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f EAR \u0430\u0432\u0442\u043e\u0440\u044b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u0443\u0441\u0440\u0435\u0434\u043d\u0438\u0442\u044c \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f EAR.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/47c\/3c1\/780\/47c3c1780e53fb32313bca779bd53a4f.png\" width=\"1024\" height=\"258\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/47c\/3c1\/780\/47c3c1780e53fb32313bca779bd53a4f.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong><em>\u0412 \u043e\u0431\u0449\u0435\u043c, \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.\u00a0\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 EAR \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 [0.0, 0.40].\u00a0<\/em>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 EAR \u0431\u044b\u0441\u0442\u0440\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u201c\u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u0433\u043b\u0430\u0437\u201d.<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u0444\u043e\u0440\u043c\u0443\u043b\u043e\u0439 EAR, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0442\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:\u00a0<strong><em>distance(\u2026), get_ear(\u2026),\u00a0<\/em><\/strong>and\u00a0<strong><em>calculate_avg_ear(\u2026).<\/em><\/strong><\/p>\n<pre><code class=\"python\">def distance(point_1, point_2):     \"\"\"Calculate l2-norm between two points\"\"\"     dist = sum([(i - j) ** 2 for i, j in zip(point_1, point_2)]) ** 0.5     return dist<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f get_ear(&#8230;) \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 .landmark \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430. \u0412 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430. \u042d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 x, y \u0438 z.<\/p>\n<pre><code class=\"python\">def get_ear(landmarks, refer_idxs, frame_width, frame_height):     \"\"\"     Calculate Eye Aspect Ratio for one eye.       Args:         landmarks: (list) Detected landmarks list         refer_idxs: (list) Index positions of the chosen landmarks                             in order P1, P2, P3, P4, P5, P6         frame_width: (int) Width of captured frame         frame_height: (int) Height of captured frame       Returns:         ear: (float) Eye aspect ratio     \"\"\"     try:         # Compute the euclidean distance between the horizontal         coords_points = []         for i in refer_idxs:             lm = landmarks[i]             coord = denormalize_coordinates(lm.x, lm.y,                                               frame_width, frame_height)             coords_points.append(coord)           # Eye landmark (x, y)-coordinates         P2_P6 = distance(coords_points[1], coords_points[5])         P3_P5 = distance(coords_points[2], coords_points[4])         P1_P4 = distance(coords_points[0], coords_points[3])           # Compute the eye aspect ratio         ear = (P2_P6 + P3_P5) \/ (2.0 * P1_P4)       except:         ear = 0.0         coords_points = None       return ear, coords_points<\/code><\/pre>\n<p> \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u00a0<strong><em>calculate_avg_ear(&#8230;)<\/em><\/strong>:  <\/p>\n<pre><code class=\"python\">def calculate_avg_ear(landmarks, left_eye_idxs, right_eye_idxs, image_w, image_h):     \"\"\"Calculate Eye aspect ratio\"\"\"       left_ear, left_lm_coordinates = get_ear(                                       landmarks,                                        left_eye_idxs,                                        image_w,                                        image_h                                     )     right_ear, right_lm_coordinates = get_ear(                                       landmarks,                                        right_eye_idxs,                                        image_w,                                        image_h                                     )     Avg_EAR = (left_ear + right_ear) \/ 2.0       return Avg_EAR, (left_lm_coordinates, right_lm_coordinates)<\/code><\/pre>\n<p> \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u043e\u0440\u043c\u0443\u043b\u0443 EAR.\u00a0\u041c\u044b \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 EAR \u0434\u043b\u044f \u0440\u0430\u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0433\u0434\u0435 \u0433\u043b\u0430\u0437\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u044b.  <\/p>\n<pre><code class=\"python\">image_eyes_open  = cv2.imread(\"test-open-eyes.jpg\")[:, :, ::-1] image_eyes_close = cv2.imread(\"test-close-eyes.jpg\")[:, :, ::-1]   for idx, image in enumerate([image_eyes_open, image_eyes_close]):          image = np.ascontiguousarray(image)     imgH, imgW, _ = image.shape       # Creating a copy of the original image for plotting the EAR value     custom_chosen_lmk_image = image.copy()       # Running inference using static_image_mode     with mp_facemesh.FaceMesh(refine_landmarks=True) as face_mesh:         results = face_mesh.process(image).multi_face_landmarks           # If detections are available.         if results:             for face_id, face_landmarks in enumerate(results):                 landmarks = face_landmarks.landmark                 EAR, _ = calculate_avg_ear(                           landmarks,                            chosen_left_eye_idxs,                            chosen_right_eye_idxs,                            imgW,                            imgH                       )                   # Print the EAR value on the custom_chosen_lmk_image.                 cv2.putText(custom_chosen_lmk_image,                              f\"EAR: {round(EAR, 2)}\", (1, 24),                             cv2.FONT_HERSHEY_COMPLEX,                              0.9, (255, 255, 255), 2                 )                                                plot(img_dt=image.copy(),                      img_eye_lmks_chosen=custom_chosen_lmk_image,                      face_landmarks=face_landmarks,                      ts_thickness=1,                       ts_circle_radius=3,                       lmk_circle_radius=3                 )<\/code><\/pre>\n<p><strong><em>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/em><\/strong>  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/feb\/cbd\/121\/febcbd1219c45e9875eaa505c7d314d9.png\" width=\"1024\" height=\"667\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/feb\/cbd\/121\/febcbd1219c45e9875eaa505c7d314d9.png\"\/><figcaption><\/figcaption><\/figure>\n<p><em>\u041a\u0430\u043a \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 EAR \u043f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0433\u043b\u0430\u0437\u0430\u0445<\/em><strong><em>\u00a0\u0440\u0430\u0432\u043d\u043e 0,28<\/em><\/strong><em>\u00a0\u0438 (\u0431\u043b\u0438\u0437\u043a\u043e \u043a \u043d\u0443\u043b\u044e)<\/em>\u00a0<strong><em>0,08, \u043a\u043e\u0433\u0434\u0430 \u0433\u043b\u0430\u0437\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u044b<\/em><\/strong><em>.<\/em><\/p>\n<p><a class=\"anchor\" name=\"5\" id=\"5\"><\/a><\/p>\n<h2>\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u043a\u043e\u0434\u0443 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u043d\u0430 Python<\/h2>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u0445 \u0431\u044b\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f.\u00a0\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043d\u0430\u0447\u043d\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0435\u00a0<strong>web-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 streamlit, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0445, \u043a\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 web-\u0431\u0440\u0430\u0443\u0437\u0435\u0440.<\/strong><\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u0436\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430:\u00a0<strong>streamlit \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0435 \u0432\u0438\u0434\u0435\u043e \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0432 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/strong>\u042d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e.\u00a0\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043e\u0431\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0443\u0442\u0438, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c OpenCV \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c IP-\u043a\u0430\u043c\u0435\u0440\u0430\u043c, \u043d\u043e \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0437\u0434\u0435\u0441\u044c.<\/p>\n<blockquote>\n<p><em>\u0414\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 streamlit \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c:<\/em><a href=\"https:\/\/github.com\/whitphx\/streamlit-webrtc\" rel=\"noopener noreferrer nofollow\"><em><u>\u00a0streamlit-webrtc<\/u><\/em><\/a><em>.\u00a0\u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \/ \u0430\u0443\u0434\u0438\u043e \u043f\u043e\u0442\u043e\u043a\u0438 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0441 streamlit.<\/em><\/p>\n<\/blockquote>\n<p><strong>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c.<\/strong><\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c\u00a0<strong><em>drowsy_detection.py<\/em>\u00a0<\/strong>\u0441\u043a\u0440\u0438\u043f\u0442 (\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438).\u00a0\u042d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043a\u043b\u0430\u0441\u0441\u044b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0430 \u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>1) \u0418\u043c\u043f\u043e\u0440\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<pre><code class=\"python\">import cv2 import time import numpy as np import mediapipe as mp from mediapipe.python.solutions.drawing_utils import _normalized_to_pixel_coordinates as denormalize_coordinates<\/code><\/pre>\n<p>2) \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.\u00a0\u041c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 3 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e \u0435\u0441\u0442\u044c,\u00a0<code>distance(\u2026)<\/code>,<code>get_ear(\u2026)\u00a0<\/code>\u0438<code>calculate_avg_ear(\u2026)<\/code>\u00a0.<\/p>\n<p>\u041d\u043e\u0432\u044b\u0435:<\/p>\n<ol>\n<li>\n<p><code>get_mediapipe_app(\u2026):<\/code>\u00a0\u0414\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f Mediapipe Face Mesh.<\/p>\n<\/li>\n<li>\n<p><code>plot_eye_landmarks(\u2026):<\/code>\u00a0\u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 (\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435) \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b \u0434\u043b\u044f \u0433\u043b\u0430\u0437.<\/p>\n<\/li>\n<li>\n<p><code>plot_text(\u2026):\u00a0<\/code>\u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u043d\u0430 \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0434\u0440\u0430\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u00a0<em>EAR<\/em>.<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">def distance(point_1, point_2):     ...     ...     return dist   def get_ear(landmarks, refer_idxs, frame_width, frame_height):     ...     ...     return ear, coords_points   def calculate_avg_ear(landmarks, left_eye_idxs, right_eye_idxs, image_w, image_h):     ...     ...     return Avg_EAR, (left_lm_coordinates, right_lm_coordinates)   def get_mediapipe_app(     max_num_faces=1,     refine_landmarks=True,     min_detection_confidence=0.5,     min_tracking_confidence=0.5, ):     \"\"\"Initialize and return Mediapipe FaceMesh Solution Graph object\"\"\"     face_mesh = mp.solutions.face_mesh.FaceMesh(         max_num_faces=max_num_faces,         refine_landmarks=refine_landmarks,         min_detection_confidence=min_detection_confidence,         min_tracking_confidence=min_tracking_confidence,     )       return face_mesh   def plot_eye_landmarks(frame, left_lm_coordinates,                         right_lm_coordinates, color                        ):     for lm_coordinates in [left_lm_coordinates, right_lm_coordinates]:         if lm_coordinates:             for coord in lm_coordinates:                 cv2.circle(frame, coord, 2, color, -1)       frame = cv2.flip(frame, 1)     return frame     def plot_text(image, text, origin,                color, font=cv2.FONT_HERSHEY_SIMPLEX,                fntScale=0.8, thickness=2               ):     image = cv2.putText(image, text, origin, font, fntScale, color, thickness)     return image<\/code><\/pre>\n<p>3) \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c\u00a0<code>VideoFrameHandler<\/code>\u00a0\u043a\u043b\u0430\u0441\u0441.\u00a0\u0412 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043c\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434 \u0434\u043b\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435.\u00a0\u0412 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430:\u00a0<code>__init__()<\/code>\u00a0\u0438.<em>\u00a0<\/em><code>process(...)<\/code><\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0445 \u043e\u0434\u0438\u043d \u0437\u0430 \u0434\u0440\u0443\u0433\u0438\u043c.<\/p>\n<pre><code class=\"python\">class VideoFrameHandler:     def __init__(self):         \"\"\"         Initialize the necessary constants, mediapipe app         and tracker variables         \"\"\"         # Left and right eye chosen landmarks.         self.eye_idxs = {             \"left\": [362, 385, 387, 263, 373, 380],             \"right\": [33, 160, 158, 133, 153, 144],         }           # Used for coloring landmark points.         # Its value depends on the current EAR value.         self.RED = (0, 0, 255)  # BGR         self.GREEN = (0, 255, 0)  # BGR           # Initializing Mediapipe FaceMesh solution pipeline         self.facemesh_model = get_mediapipe_app()           # For tracking counters and sharing states in and out of callbacks.         self.state_tracker = {             \"start_time\": time.perf_counter(),             \"DROWSY_TIME\": 0.0,  # Holds time passed with EAR &lt; EAR_THRESH             \"COLOR\": self.GREEN,             \"play_alarm\": False,         }           self.EAR_txt_pos = (10, 30)<\/code><\/pre>\n<ol>\n<li>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c\u00a0<code>self.eye_idxs<\/code>\u00a0\u0441\u043b\u043e\u0432\u0430\u0440\u044c.\u00a0\u042d\u0442\u043e\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432 \u0434\u043b\u044f \u043b\u0435\u0432\u043e\u0433\u043e \u0438 \u043f\u0440\u0430\u0432\u043e\u0433\u043e \u0433\u043b\u0430\u0437\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0432\u0435 \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435\u00a0<code>self.RED<\/code>\u0438\u00a0<code>self.GREEN<\/code>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u043a\u0440\u0430\u0448\u0438\u0432\u0430\u043d\u0438\u044f \u0442\u043e\u0447\u0435\u043a \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f EAR \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439\u00a0<code>DROWSY_TIME<\/code>counter \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043b\u0438\u0446\u0435\u0432\u043e\u0439 \u0441\u0435\u0442\u043a\u0438 Mediapipe.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c\u00a0<code>self.state_tracker<\/code>\u0441\u043b\u043e\u0432\u0430\u0440\u044c.\u00a0\u042d\u0442\u043e\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f.\u00a0\u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u00a0<em>start_time<\/em>\u00a0\u0438\u00a0<code>DROWSY_TIME<\/code>\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0438\u043c\u0435\u044e\u0449\u0438\u0435 \u0440\u0435\u0448\u0430\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 EAR \u043d\u0430\u00a0<code>frame<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u00a0<em>process(&#8230;)<\/em>:<\/p>\n<pre><code class=\"python\">def process(self, frame: np.array, thresholds: dict):         \"\"\"         This function is used to implement our Drowsy detection algorithm.           Args:             frame: (np.array) Input frame matrix.             thresholds: (dict) Contains the two threshold values                                WAIT_TIME and EAR_THRESH.           Returns:             The processed frame and a boolean flag to             indicate if the alarm should be played or not.         \"\"\"           # To improve performance,         # mark the frame as not writeable to pass by reference.         frame.flags.writeable = False         frame_h, frame_w, _ = frame.shape         DROWSY_TIME_txt_pos = (10, int(frame_h \/\/ 2 * 1.7))         ALM_txt_pos = (10, int(frame_h \/\/ 2 * 1.85))           results = self.facemesh_model.process(frame)           if results.multi_face_landmarks:             landmarks = results.multi_face_landmarks[0].landmark             EAR, coordinates = calculate_avg_ear(landmarks,                                                  self.eye_idxs[\"left\"],                                                   self.eye_idxs[\"right\"],                                                   frame_w,                                                   frame_h                                                  )             frame = plot_eye_landmarks(frame,                                         coordinates[0],                                         coordinates[1],                                        self.state_tracker[\"COLOR\"]                                        )               if EAR &lt; thresholds[\"EAR_THRESH\"]:                   # Increase DROWSY_TIME to track the time period with                  # EAR less than the threshold                 # and reset the start_time for the next iteration.                 end_time = time.perf_counter()                   self.state_tracker[\"DROWSY_TIME\"] += end_time - self.state_tracker[\"start_time\"]                 self.state_tracker[\"start_time\"] = end_time                 self.state_tracker[\"COLOR\"] = self.RED                   if self.state_tracker[\"DROWSY_TIME\"] >= thresholds[\"WAIT_TIME\"]:                     self.state_tracker[\"play_alarm\"] = True                     plot_text(frame, \"WAKE UP! WAKE UP\",                                ALM_txt_pos, self.state_tracker[\"COLOR\"])               else:                 self.state_tracker[\"start_time\"] = time.perf_counter()                 self.state_tracker[\"DROWSY_TIME\"] = 0.0                 self.state_tracker[\"COLOR\"] = self.GREEN                 self.state_tracker[\"play_alarm\"] = False               EAR_txt = f\"EAR: {round(EAR, 2)}\"             DROWSY_TIME_txt = f\"DROWSY: {round(self.state_tracker['DROWSY_TIME'], 3)} Secs\"             plot_text(frame, EAR_txt,                        self.EAR_txt_pos, self.state_tracker[\"COLOR\"])             plot_text(frame, DROWSY_TIME_txt,                        DROWSY_TIME_txt_pos, self.state_tracker[\"COLOR\"])           else:             self.state_tracker[\"start_time\"] = time.perf_counter()             self.state_tracker[\"DROWSY_TIME\"] = 0.0             self.state_tracker[\"COLOR\"] = self.GREEN             self.state_tracker[\"play_alarm\"] = False               # Flip the frame horizontally for a selfie-view display.             frame = cv2.flip(frame, 1)           return frame, self.state_tracker[\"play_alarm\"]<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c,<\/p>\n<ol>\n<li>\n<p>\u041c\u044b \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438\u00a0<code>.writeable<\/code>\u0444\u043b\u0430\u0433\u0430 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435\u00a0<em>frame<\/em>\u00a0NumPy \u0440\u0430\u0432\u043d\u044b\u043c\u00a0<code>False<\/code>.\u00a0\u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.\u00a0\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043a\u043e\u043f\u0438\u0438\u00a0<code>frame\u00a0<\/code>\u0432 \u043a\u0430\u0436\u0434\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043c\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430\u00a0<code>frame<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u043a\u0430\u0434\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0445\u043e\u0434\u043d\u044b\u0435\u00a0<code>frame\u00a0<\/code>\u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u044d\u0442\u043e\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u0443, \u0431\u0443\u0434\u0443\u0442 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435\u00a0<em>RGB<\/em>.\u00a0\u042d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u0430\u044f \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430.\u00a0\u041c\u043e\u0434\u0435\u043b\u044c Mediapipe<em>\u00a0<\/em>\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u044d\u0442\u043e\u0442<em>\u00a0<\/em><code>frame<\/code>\u00a0\u043a\u0430\u043a \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.\u00a0\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0432\u00a0<code>results<\/code>\u00a0\u043e\u0431\u044a\u0435\u043a\u0442\u0435.<\/p>\n<\/li>\n<\/ol>\n<p>\u0421 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043a\u043e\u0434 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0431\u043b\u043e\u043a-\u0441\u0445\u0435\u043c\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u0438 \u0432\u044b\u0448\u0435.<\/p>\n<ol>\n<li>\n<p><strong><em>1-\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 if<\/em><\/strong>\u00a0\u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043d\u0435\u0442.\u00a0\u0415\u0441\u043b\u0438\u00a0<em>True<\/em>,\u00a0<code>calculate_avg_ear(\u2026)<\/code>\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0<em>EAR<\/em>.\u00a0\u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0435\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0434\u043b\u044f \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432.\u00a0<code>plot_eye_landmarks(\u2026)<\/code>\u0413\u0440\u0430\u0444\u0438\u043a\u0438 \u044d\u0442\u0438\u0445 \u0434\u0435\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043d\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f\u00a0<strong><em>2-\u044f if-\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430<\/em><\/strong>, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0438\u0439<code>\u00a0EAR &lt; EAR_THRESH<\/code>.\u00a0\u0415\u0441\u043b\u0438 True, \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 current_time\u00a0<em>(end_time)<\/em>\u00a0\u0438\u00a0<em>start_time .\u00a0<\/em>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0<code>DROWSY_TIME\u00a0<\/code>\u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u043e\u0439 \u0440\u0430\u0437\u043d\u0438\u0446\u044b<em>.\u00a0<\/em>\u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c\u00a0<code>start_time<\/code>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<code>end_time<\/code>\u00a0.\u00a0\u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442, \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u044f \u0432\u0440\u0435\u043c\u044f \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043a\u0430\u0434\u0440\u043e\u043c (\u0435\u0441\u043b\u0438\u00a0<code>EAR<\/code>\u043e\u043d\u043e \u0432\u0441\u0435 \u0435\u0449\u0435 \u043c\u0435\u043d\u044c\u0448\u0435<code>EAR_THRESH<\/code>).<\/p>\n<\/li>\n<li>\n<p><strong>3-\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 if<\/strong>\u00a0\u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u00a0<code>DROWSY_TIME >= WAIT_TIME<\/code>.\u00a0<code>WAIT_TIME<\/code>\u041f\u043e\u0440\u043e\u0433\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c\u0438 \u0433\u043b\u0430\u0437\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 3-\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0438\u0441\u0442\u0438\u043d\u043d\u043e, \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u00a0<code>play_alarm<\/code>\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0444\u043b\u0430\u0433\u0430\u00a0<code>True<\/code>\u0440\u0430\u0432\u043d\u044b\u043c .<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f 1-\u0435 \u0438 2-\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f<code>False<\/code>, \u0441\u0431\u0440\u043e\u0441\u044c\u0442\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.\u00a0\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u00a0<code>COLOR<\/code>\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439.\u00a0\u0426\u0432\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043b\u044f \u043f\u0435\u0447\u0430\u0442\u0438\u00a0<code>EAR<\/code>\u0438\u00a0<code>DROWSY_TIME<\/code>\u043d\u0430\u00a0<em>\u0440\u0430\u043c\u043a\u0435<\/em>\u00a0\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442\u00a0<code>COLOR\u00a0<\/code>\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u043a\u0430\u0434\u0440 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439\u00a0<code>play_alarm<\/code>\u00a0\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f\u00a0<strong><em>drowsy_detection.py<\/em><\/strong>\u00a0\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c\u00a0<strong><em>streamlit_app.py<\/em><\/strong><em>\u00a0<\/em>\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439.\u00a0\u042d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \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 \u043d\u0430\u0448\u0435\u0433\u043e \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0430 (\u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439) \u0438 \u043a\u043d\u043e\u043f\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.\u00a0\u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u043a\u043e\u0434, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441\u00a0<strong>\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 streamlit-webrtc<\/strong>.<\/p>\n<p>(\u042d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043a\u043e\u0434\u0430.)<\/p>\n<pre><code class=\"python\">import os import av import threading import streamlit as st from streamlit_webrtc import VideoHTMLAttributes, webrtc_streamer   from audio_handling import AudioFrameHandler from drowsy_detection import VideoFrameHandler   # Define the audio file to use. alarm_file_path = os.path.join(\"audio\", \"wake_up.wav\")   # Streamlit Components st.set_page_config(     page_title=\"Drowsiness Detection | LearnOpenCV\",     page_icon=\"https:\/\/learnopencv.com\/wp-content\/uploads\/2017\/12\/favicon.png\",     layout=\"centered\",     initial_sidebar_state=\"expanded\",     menu_items={         \"About\": \"### Visit www.learnopencv.com for more exciting tutorials!!!\",     }, )   st.title(\"Drowsiness Detection!\")   col1, col2 = st.columns(spec=[1, 1])   with col1:     # Lowest valid value of Eye Aspect Ratio. Ideal values [0.15, 0.2].     EAR_THRESH = st.slider(\"Eye Aspect Ratio threshold:\", 0.0, 0.4, 0.18, 0.01)   with col2:     # The amount of time (in seconds) to wait before sounding the alarm.     WAIT_TIME = st.slider(\"Seconds to wait before sounding alarm:\", 0.0, 5.0, 1.0, 0.25)   thresholds = {     \"EAR_THRESH\": EAR_THRESH,     \"WAIT_TIME\": WAIT_TIME, }   # For streamlit-webrtc video_handler = VideoFrameHandler() audio_handler = AudioFrameHandler(sound_file_path=alarm_file_path)   # For thread-safe access &amp; to prevent race-condition. lock = threading.Lock()     shared_state = {\"play_alarm\": False}   def video_frame_callback(frame: av.VideoFrame):     frame = frame.to_ndarray(format=\"bgr24\")  # Decode and convert frame to RGB       frame, play_alarm = video_handler.process(frame, thresholds)  # Process frame     with lock:         shared_state[\"play_alarm\"] = play_alarm  # Update shared state           # Encode and return BGR frame     return av.VideoFrame.from_ndarray(frame, format=\"bgr24\")     def audio_frame_callback(frame: av.AudioFrame):     with lock:  # access the current \u201cplay_alarm\u201d state         play_alarm = shared_state[\"play_alarm\"]       new_frame: av.AudioFrame = audio_handler.process(frame,                                                      play_sound=play_alarm)     return new_frame   ctx = webrtc_streamer(     key=\"driver-drowsiness-detection\",     video_frame_callback=video_frame_callback,     audio_frame_callback=audio_frame_callback,     rtc_configuration={\"iceServers\": [{\"urls\": [\"stun:stun.l.google.com:19302\"]}]},     media_stream_constraints={\"video\": {\"width\": True, \"audio\": True},     video_html_attrs=VideoHTMLAttributes(autoPlay=True, controls=False, muted=False), )<\/code><\/pre>\n<ol>\n<li>\n<p>\u041c\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0434\u0432\u0443\u0445 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438,\u00a0<code>VideoFrameHandler<\/code>\u0438\u00a0<code>AudioFrameHandler<\/code>.\u00a0\u042f \u0441\u043a\u043e\u0440\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438\u00a0<code>AudioFrameHandler\u00a0<\/code>\u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u043c\u044b \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b\u00a0\u043d\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0435<strong>\u00a0<\/strong>streamlit, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0438 \u0434\u0432\u0430 \u043f\u043e\u043b\u0437\u0443\u043d\u043a\u0430 (<code>EAR_THESH\u00a0<\/code>\u0438\u00a0<code>WAIT_TIME<\/code>)<em>.\u00a0<\/em>\u041c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u00a0<em>\u043c\u0435\u0442\u043e\u0434\u0443 VideoHandler\u2019s<\/em> <em>process(&#8230;)<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0434\u0432\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430:\u00a0<code>video_handler<\/code>\u00a0\u0438\u00a0<code>audio_handler<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u043f\u043e\u0442\u043e\u043a\u0430\u00a0<code>shared_state<\/code>\u00a0\u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044f.\u00a0\u041e\u0431\u044a\u0435\u043a\u0442 dictionary \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0443 \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0442\u043e\u00a0<code>play_alarm<\/code>\u00a0\u0435\u0441\u0442\u044c \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0444\u043b\u0430\u0433.\u00a0\u0415\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442\u00a0<code>play_alarm<\/code>\u00a0\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u043c\u00a0<em>.process(&#8230;<\/em>)<em>\u00a0\u043a\u043b\u0430\u0441\u0441\u0430 VideoFrameHandler .<\/em><\/p>\n<\/li>\n<li>\n<p>(\u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0439)\u00a0<code>shared_state<\/code>\u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438:\u00a0<code>video_frame_callback<\/code>\u0438\u00a0<code>audio_frame_callback<\/code>.<\/p>\n<\/li>\n<li>\n<p><em>\u0424\u0443\u043d\u043a\u0446\u0438\u044f\u00a0<\/em>video_frame_callback \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0434\u0440\u043e\u0432.\u00a0\u041e\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043a\u0430\u0434\u0440\u0443 \u0437\u0430 \u0440\u0430\u0437 \u043e\u0442 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e,\u00a0<code>audio_frame_callback<\/code>\u00a0\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0437\u0432\u0443\u043a\u043e\u0432\u044b\u0445 \u043a\u0430\u0434\u0440\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u043b.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u00a0<strong>streamlit-webrtc<\/strong>\u00a0<code>webrtc-streamer<\/code>.\u00a0\u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043a\u0430\u0434\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c.<\/p>\n<\/li>\n<\/ol>\n<p>\u0418 \u043d\u0430 \u044d\u0442\u043e\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f\u00a0<strong><em>streamlit_app.py<\/em><\/strong>\u00a0\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:\u00a0<code>video_frame_callback<\/code>\u00a0\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u00a0<code>VideoFrame<\/code>\u00a0\u043e\u0431\u044a\u0435\u043a\u0442 (\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430)<em>\u00a0<\/em>\u0438\u00a0<code>audio_frame_callback<\/code>\u00a0\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u00a0<code>AudioFrame<\/code>\u043e\u0431\u044a\u0435\u043a\u0442 (\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u043b\u0438\u043d\u044b).\u00a0\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f\u00a0<strong>streamlit-webrtc.\u00a0<\/strong>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u0435\u0431-\u043a\u0430\u043c\u0435\u0440\u044b \u0438 \u043c\u0438\u043a\u0440\u043e\u0444\u043e\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e.\u00a0\u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0434\u0440\u044b \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438 \u0430\u0443\u0434\u0438\u043e\u0434\u0430\u043d\u043d\u044b\u043c\u0438 (\u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f).<\/p>\n<p>\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u043c\u0441\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f\u00a0<strong><em>audio_handling.py<\/em><\/strong>\u00a0\u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u00a0<code>AudioFrameHandler<\/code>\u00a0\u043a\u043b\u0430\u0441\u0441.\u00a0\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u0434, \u043d\u043e \u043c\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0441\u0443\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0439 \u044d\u0442\u0438\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c.\u00a0\u041c\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043c, \u043a\u0430\u043a \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0430\u0443\u0434\u0438\u043e\u043a\u0430\u0434\u0440.<\/p>\n<ol>\n<li>\n<p>\u0412\u00a0<code>audio_frame_callback<\/code>\u00a0\u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0432\u044b\u0448\u0435, \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043c\u0435\u0442\u043a\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c audio frame \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u0444\u043e\u0440\u043c\u044b, frame_rate, \u043a\u0430\u043d\u0430\u043b\u043e\u0432 \u0438 \u0442. \u0414.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0432\u0445\u043e\u0434\u043d\u043e\u0439 audio frame \u0438\u043c\u0435\u0435\u0442 \u0434\u043b\u0438\u043d\u0443\u00a0<em>20 \u043c\u0441<\/em>.\u00a0\u0422\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u0448 \u0444\u0430\u0439\u043b alarm \/ sound \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.\u00a0\u0418 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0435\u0441\u044c \u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0437\u0430 \u043e\u0434\u0438\u043d \u0440\u0430\u0437.\u00a0\u0415\u0441\u043b\u0438 \u043c\u044b \u0441\u0436\u043c\u0435\u043c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043c \u0435\u0433\u043e, \u0437\u0432\u0443\u043a \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c \u0432\u0441\u043f\u043b\u0435\u0441\u043a\u043e\u043c \u0448\u0443\u043c\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0439 \u0444\u0430\u0439\u043b \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a\u0430 \u043d\u0430\u00a0<em>\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u0438\u043d\u043e\u0439 20 \u043c\u0441<\/em>.\u00a0\u0417\u0430\u0442\u0435\u043c, \u0435\u0441\u043b\u0438\u00a0<code>play_alarm<\/code>\u0444\u043b\u0430\u0433\u00a0<code>True<\/code>\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0439\u0442\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043d\u0430\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u0444\u0430\u0439\u043b\u0430 \u0442\u0440\u0435\u0432\u043e\u0433\u0438 \u043e\u0434\u0438\u043d \u0437\u0430 \u0434\u0440\u0443\u0433\u0438\u043c, \u043f\u043e\u043a\u0430 \u043c\u044b \u043d\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u044d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0432: \u043f\u0440\u0438 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0435 \u043c\u044b \u043d\u0435 \u0432\u0442\u0438\u0441\u043a\u0438\u0432\u0430\u0435\u043c \u0432\u0441\u0435, \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u043c \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0441\u043a\u0430\u0436\u0435\u043c, \u0437\u0430 20 \u043c\u0441, \u043d\u043e \u044d\u0442\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f (> 20 \u043c\u0441).\u00a0\u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043f\u0440\u043e\u0438\u0437\u043d\u043e\u0441\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f.\u00a0\u041f\u043e\u043b\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0432\u0441\u0435 \u044d\u0442\u0438 \u043c\u0435\u043b\u044c\u0447\u0430\u0439\u0448\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u043d\u0435\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u043b\u0438\u0441\u044c \u0432\u043c\u0435\u0441\u0442\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0412\u00a0<code>audio_frame_callback<\/code>\u00a0\u0444\u0443\u043d\u043a\u0446\u0438\u0438\u00a0<code>.process(...)<\/code>\u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u043c \u0430\u0443\u0434\u0438\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u044d\u0442\u043e\u0433\u043e \u0430\u0443\u0434\u0438\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u0445 \u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u0445.\u00a0<code>.prepare_audio(\u2026)\u00a0<\/code>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0432\u0445\u043e\u0434\u043d\u043e\u043c audio frame \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e audio frame\u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0439 \u0444\u0430\u0439\u043b \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0442\u0440\u0435\u0432\u043e\u0433\u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442\u00a0<code>play_sound<\/code>\u00a0\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0444\u043b\u0430\u0433\u0430, \u043c\u044b \u043b\u0438\u0431\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043d\u0430\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0442\u0440\u0435\u0432\u043e\u0433\u0438, \u043b\u0438\u0431\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u0430\u043c\u043f\u043b\u0438\u0442\u0443\u0434\u0443 (\u043e\u0431\u044b\u0447\u043d\u043e, \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u044c) \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0443\u0434\u0438\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u043d\u0430\u00a0<em>-100<\/em>.\u00a0\u041e\u043d \u0433\u0430\u0441\u0438\u0442 \u0432\u0441\u044e \u0432\u0445\u043e\u0434\u043d\u0443\u044e \u0437\u0432\u0443\u043a\u043e\u0432\u0443\u044e \u0432\u043e\u043b\u043d\u0443 \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u044d\u0444\u0444\u0435\u043a\u0442\u00a0<em>\u0442\u0438\u0448\u0438\u043d\u044b<\/em>.<\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u0444\u0438\u043d\u0430\u043b\u00a0<strong><em>audio_handling.py<\/em><\/strong>\u00a0\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439.<\/p>\n<p><strong><em>\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u043d\u0430\u0448\u0435\u00a0<\/em><\/strong><a href=\"https:\/\/veb-101-drowsiness-detection-using-mediapipe-stream-main-608lfs.streamlitapp.com\/\" rel=\"noopener noreferrer nofollow\"><strong><em><u>\u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u043c \u043e\u0431\u043b\u0430\u043a\u0435<\/u><\/em><\/strong><\/a><strong><em>.<\/em><\/strong>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0432\u0438\u0434\u0435\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c \u044d\u043a\u0440\u0430\u043d\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/638db21e61ecc8ef4a814dc6\" data-style=\"\" id=\"638db21e61ecc8ef4a814dc6\" width=\"\"><\/div>\n<p><a class=\"anchor\" name=\"6\" id=\"6\"><\/a><\/p>\n<h2>Summary<\/h2>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043d\u0430\u0448\u0435\u0439 \u0446\u0435\u043b\u044c\u044e \u0431\u044b\u043b\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Mediapipe \u043d\u0430 Python. \u041c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435, \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 python. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 Face Mesh \u043e\u0442 Mediapipe \u0438 \u0444\u043e\u0440\u043c\u0443\u043b\u0443 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u043d \u0433\u043b\u0430\u0437. \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \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 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Streamlit \u0438 streamlit-webrtc. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u044b \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0435 \u0432 \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435.<\/p>\n<p>\u042d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u043e \u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439. \u0414\u0440\u0443\u0433\u0438\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 (\u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u0442\u043e\u0433\u043e \u0436\u0435 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0441\u0435\u0442\u043a\u0438 \u043b\u0438\u0446), \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u0433\u043b\u0430\u0437 \u0438\u0437 \u043a\u0430\u0434\u0440\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0438\u0445 \u0447\u0435\u0440\u0435\u0437 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438. \u041c\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 \u043d\u0430\u0448\u0438\u0445 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445. \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0438 \u043e\u0441\u0432\u043e\u0438\u0442\u044c \u0432\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b.<\/p>\n<blockquote>\n<p>\u041a\u043e\u0434 \u043d\u0430 <a href=\"https:\/\/github.com\/spmallick\/learnopencv\/tree\/master\/Driver-Drowsiness-detection-using-Mediapipe-in-Python\" rel=\"noopener noreferrer nofollow\">Github<\/a><\/p>\n<\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/703496\/\"> https:\/\/habr.com\/ru\/post\/703496\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e \u0434\u0430\u043d\u043d\u044b\u043c CDC (<em>\u0426\u0435\u043d\u0442\u0440\u044b \u043f\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044e \u0438 \u043f\u0440\u043e\u0444\u0438\u043b\u0430\u043a\u0442\u0438\u043a\u0435 \u0437\u0430\u0431\u043e\u043b\u0435\u0432\u0430\u043d\u0438\u0439 \u0421\u0428\u0410<\/em>), \u201c\u043f\u043e \u043e\u0446\u0435\u043d\u043a\u0430\u043c, 1 \u0438\u0437 25 \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0445 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u0439 (18 \u043b\u0435\u0442 \u0438 \u0441\u0442\u0430\u0440\u0448\u0435) \u0441\u043e\u043e\u0431\u0449\u0430\u044e\u0442 \u043e \u0437\u0430\u0441\u044b\u043f\u0430\u043d\u0438\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u043e\u0436\u0434\u0435\u043d\u0438\u044f &#8230;\u201d.\u00a0\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f:\u00a0<em>\u201c&#8230; \u0441\u043e\u043d\u043d\u043e\u0435 \u0432\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043b\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 91 000 \u0434\u043e\u0440\u043e\u0436\u043d\u043e-\u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0441\u0448\u0435\u0441\u0442\u0432\u0438\u0439 &#8230;\u201d.<\/em>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u043e\u0447\u044c \u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443\u00a0<strong>\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f API-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Mediapipe \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f Face Mesh \u043d\u0430 Python<\/strong>.\u00a0\u042d\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u044e\u0442 \u0431\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e\u0442 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f. <\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/638d987561ecc8ef4a813fda\" data-style=\"\" id=\"638d987561ecc8ef4a813fda\" width=\"\"><\/div>\n<h2>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e MediaPipe \u0432 Python [TL; DR]<\/h2>\n<p>\u041d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0435 \u0432\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0442\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0438 \u0438\u0437\u043c\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u043c. \u0410\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0438\u0441\u0442 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0437\u0430\u0434\u0440\u0435\u043c\u0430\u0442\u044c \u0438\u0437-\u0437\u0430 \u0431\u0435\u0437\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 <strong>Face Mesh \u043e\u0442 Mediapipe<\/strong> \u043d\u0430 <strong>python<\/strong> \u0438 <strong>\u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u043e\u043d \u0433\u043b\u0430\u0437<\/strong>. \u041d\u0430\u0448\u0430 \u0446\u0435\u043b\u044c &#8212; \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0435 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0435\u0441\u043b\u0438 \u0438\u0445 \u0433\u043b\u0430\u0437\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u044b \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b:<\/p>\n<ol>\n<li>\n<p>\u0423\u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b \u0434\u043b\u044f \u0433\u043b\u0430\u0437 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<strong>\u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f Mediapipe Face Mesh \u043d\u0430 python<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0438 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0442\u0435\u0445\u043d\u0438\u043a\u0443\u00a0<strong>\u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u043d \u0433\u043b\u0430\u0437\u0430 (EAR)<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f\u00a0<strong>\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f<\/strong>\u00a0\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<strong>streamlit<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u00a0<strong>streamlit-webrtc<\/strong>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u043e\u0447\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \/ \u0430\u0443\u0434\u0438\u043e \u043f\u043e\u0442\u043e\u043a\u0438 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e \u0441\u0435\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0430\u0437\u0432\u0435\u0440\u043d\u0435\u043c<\/strong>\u00a0\u0435\u0433\u043e \u0432 \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0439 \u0441\u043b\u0443\u0436\u0431\u0435.<\/p>\n<\/li>\n<\/ol>\n<h2>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h2>\n<ol>\n<li>\n<p><a href=\"#1\" rel=\"noopener noreferrer nofollow\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0441\u043e\u043d\u043d\u043e\u0435 \u0432\u043e\u0436\u0434\u0435\u043d\u0438\u0435?<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#2\" rel=\"noopener noreferrer nofollow\">\u041d\u0430\u0448 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#3\" rel=\"noopener noreferrer nofollow\">\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0435\u0442\u043a\u0438 \u0433\u0440\u0430\u043d\u0435\u0439 MediaPipe \u0432 Python<\/a><\/p>\n<ol>\n<li>\n<p><a href=\"#3.1.\" rel=\"noopener noreferrer nofollow\">\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0441 \u043b\u0438\u0446\u0435\u0432\u043e\u0439 \u0441\u0435\u0442\u043a\u043e\u0439<\/a><\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p><a href=\"#4\" rel=\"noopener noreferrer nofollow\">\u041c\u0435\u0442\u043e\u0434 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u043d \u0433\u043b\u0430\u0437\u0430 (EAR)<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#5\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u043a\u043e\u0434\u0443 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u043d\u0430 Python<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#6\" rel=\"noopener noreferrer nofollow\">Summary<\/a><\/p>\n<\/li>\n<\/ol>\n<p><a class=\"anchor\" name=\"1\" id=\"1\"><\/a><\/p>\n<h2>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0441\u043e\u043d\u043d\u043e\u0435 \u0432\u043e\u0436\u0434\u0435\u043d\u0438\u0435?<\/h2>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0435 \u0432\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0442\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0438 \u0438\u0437\u043c\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u043c. CDC \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u043a\u0430\u043a \u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435 \u0432\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0438 \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0438\u043b\u0438 \u0443\u0441\u0442\u0430\u043b\u043e\u0441\u0442\u0438. \u0418\u0437-\u0437\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u043b\u0430 \u0443 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0447\u0430\u0442\u044c \u0441\u043b\u0438\u043f\u0430\u0442\u044c\u0441\u044f \u0433\u043b\u0430\u0437\u0430, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u044c \u0438 \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0437\u0430\u0441\u043d\u0443\u0442\u044c \u0437\u0430 \u0440\u0443\u043b\u0435\u043c.<\/p>\n<p><strong>\u041d\u0430\u0448\u0430 \u0446\u0435\u043b\u044c &#8212; \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043d\u044b\u0445 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0435\u0441\u043b\u0438 \u0438\u0445 \u0433\u043b\u0430\u0437\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u044b \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/strong><\/p>\n<p><a class=\"anchor\" name=\"2\" id=\"2\"><\/a><\/p>\n<h2>\u041d\u0430\u0448 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f<\/h2>\n<p><strong><em>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f?<\/em><\/strong><\/p>\n<p>\u0418\u043c\u0435\u044f \u0432 \u0432\u0438\u0434\u0443 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e:<\/p>\n<ol>\n<li>\n<p><strong>\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u0430\u043c\u0435\u0440\u0435.<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043b\u0438\u0446\u0435\u0432\u044b\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432.<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u201c<em>\u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0435 \u0432\u0435\u043a\u0438. \u201d<\/em><\/strong><\/p>\n<\/li>\n<\/ol>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<ul>\n<li>\n<p><em>\u0414\u043b\u044f \u043f\u0443\u043d\u043a\u0442\u0430 1:<\/em>\u00a0\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u043a\u0430\u043c\u0435\u0440\u0443, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0443\u044e \u043a \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435.\u00a0\u0412 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0431-\u043a\u0430\u043c\u0435\u0440\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043f\u0443\u043d\u043a\u0442\u0430 2: \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0440\u0435\u0448\u0435\u043d\u0438\u044f <strong>Mediapipe Face Mesh<\/strong> \u043d\u0430 python.<\/p>\n<\/li>\n<li>\n<p><em>\u0414\u043b\u044f \u043f\u0443\u043d\u043a\u0442\u0430 3:<\/em>\u00a0\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u043d\u043e \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439\u00a0<strong>\u0421\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u043e\u043d \u0433\u043b\u0430\u0437<\/strong>\u00a0(EAR) \u043c\u0435\u0442\u043e\u0434, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432\u00a0<a href=\"http:\/\/vision.fe.uni-lj.si\/cvww2016\/proceedings\/papers\/05.pdf\" rel=\"noopener noreferrer nofollow\"><u>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0440\u0433\u0430\u043d\u0438\u044f \u0433\u043b\u0430\u0437 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043b\u0438\u0446\u0435\u0432\u044b\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432<\/u><\/a>.<\/p>\n<\/li>\n<\/ul>\n<p>(\u041c\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u043f\u0443\u043d\u043a\u0442\u044b 2 \u0438 3 \u043f\u043e\u0437\u0436\u0435 \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435.)<\/p>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435 \u0441\u0442\u0430\u0442\u044c\u0435 \u0430\u0432\u0442\u043e\u0440\u044b \u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u0441\u0432\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a\u00a0<em>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043c\u0438\u0433\u0430\u043d\u0438\u044f<\/em>.\u00a0\u041c\u043e\u0440\u0433\u0430\u043d\u0438\u0435 \u0433\u043b\u0430\u0437 &#8212; \u044d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f.\u00a0\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 SVM \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0440\u0433\u0430\u043d\u0438\u044f \u0433\u043b\u0430\u0437 \u043a\u0430\u043a \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 EAR \u0432 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043e\u043a\u043d\u0435.<\/p>\n<p><strong><em>\u041a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u044c?<\/em><\/strong><\/p>\n<p>\u041c\u044b \u043d\u0435 \u0441\u0442\u0440\u0435\u043c\u0438\u043c\u0441\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u201c\u043c\u0438\u0433\u0430\u043d\u0438\u044f\u201d, \u0430 \u0441\u043a\u043e\u0440\u0435\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u044b \u0433\u043b\u0430\u0437\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442.\u00a0\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u0434\u0430\u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u0430\u043a\u043e\u0435-\u043b\u0438\u0431\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435.\u00a0\u041c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435\u043c,\u00a0<strong><em>\u201c\u041d\u0430\u0448\u0438 \u0433\u043b\u0430\u0437\u0430 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u044e\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0447\u0443\u0432\u0441\u0442\u0432\u0443\u0435\u043c \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u044c\u201d.<\/em><\/strong><\/p>\n<p><strong><em>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u043b\u0438 \u0433\u043b\u0430\u0437\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c\u0438 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/em><\/strong><\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0437\u0430\u043a\u0440\u044b\u0442\u044b \u0433\u043b\u0430\u0437\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0<strong>\u0421\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u043e\u043d \u0433\u043b\u0430\u0437<\/strong>\u00a0(EAR) \u0444\u043e\u0440\u043c\u0443\u043b\u0430:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p><em>\u0424\u043e\u0440\u043c\u0443\u043b\u0430 EAR \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0433\u043b\u0430\u0437.<\/em>  <\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0430\u0448 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \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><strong><em>\u201c\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 EAR \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u0430\u0434\u0440\u0430\u0445.\u00a0\u0415\u0441\u043b\u0438 \u0433\u043b\u0430\u0437\u0430 \u0431\u044b\u043b\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u044b \u0434\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0437\u0430\u0434\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043c\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u043c \u0441\u0438\u0433\u043d\u0430\u043b \u0442\u0440\u0435\u0432\u043e\u0433\u0438 \u201d.<\/em><\/strong><\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<ol>\n<li>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u0434\u0432\u0430 \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0441\u0447\u0435\u0442\u0447\u0438\u043a.<\/p>\n<ol>\n<li>\n<p><code>EAR_thresh<\/code>:<em>\u00a0<\/em>\u041f\u043e\u0440\u043e\u0433\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 EAR \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430.<\/p>\n<\/li>\n<li>\n<p><code>D_TIME<\/code>: \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430 \u0434\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0435\u0433\u043e \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c\u00a0<code>EAR &lt; EAR_THRESH.<\/code>\u00a0<\/p>\n<\/li>\n<li>\n<p><em>WAIT_TIME:\u00a0<\/em>\u0427\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043f\u0440\u043e\u0448\u043b\u043e \u043b\u0438 \u0432\u0440\u0435\u043c\u044f \u0441\u00a0<code>EAR &lt; EAR_THRESH<\/code>\u00a0\u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u043f\u0440\u0435\u0434\u0435\u043b.<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f (\u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445) \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e\u00a0<code>t1<\/code>\u00a0\u0438 \u0441\u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043a\u0430\u0434\u0440.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c\u00a0<code>frame<\/code><strong>\u00a0<\/strong>\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 <strong>Mediapipe Face Mesh<\/strong> \u043d\u0430 python.<\/p>\n<\/li>\n<li>\n<p>\u041c\u044b \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 (<strong>P<sub>i<\/sub><\/strong>) \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b \u0434\u043b\u044f \u0433\u043b\u0430\u0437, \u0435\u0441\u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b.\u00a0\u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u0431\u0440\u043e\u0441\u00a0<code>t1\u00a0<\/code>\u0438\u00a0<code>D_TIME\u00a0(D_TIME<\/code>\u00a0\u0442\u0430\u043a\u0436\u0435 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0434\u0435\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u043c).<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b, \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0435\u00a0<strong>EAR <\/strong>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u0433\u043b\u0430\u0437 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432 \u0434\u043b\u044f \u0433\u043b\u0430\u0437.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0430\u044f\u00a0<code>EAR\u00a0&lt;\u00a0EAR_THRESH<\/code>, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c\u00a0<code>t2<\/code>\u00a0\u0438\u00a0<code>t1<\/code>\u00a0\u0414\u043b\u044f\u00a0<code>D_TIME<\/code>.\u00a0\u0417\u0430\u0442\u0435\u043c \u0441\u0431\u0440\u043e\u0441\u044c\u0442\u0435\u00a0<code>t1\u00a0<\/code>\u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u0430\u0434\u0440\u0430 \u043a\u0430\u043a\u00a0<code>t2<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u00a0<code>D_TIME >= WAIT_TIME<\/code>, \u043c\u044b\u00a0<strong>\u043f\u043e\u0434\u043d\u0438\u043c\u0438\u0442\u0435 \u0442\u0440\u0435\u0432\u043e\u0433\u0443\u00a0<\/strong>\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u0435 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043a\u0430\u0434\u0440\u0443.<\/p>\n<\/li>\n<\/ol>\n<p><a class=\"anchor\" name=\"3\" id=\"3\"><\/a><\/p>\n<h2>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0435\u0442\u043a\u0438 \u0433\u0440\u0430\u043d\u0435\u0439 MediaPipe \u0432 Python<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e Mediapipe, \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u043d\u0430\u0448\u0438\u043c\u00a0<a href=\"https:\/\/learnopencv.com\/introduction-to-mediapipe\/\" rel=\"noopener noreferrer nofollow\"><u>\u0432\u0432\u043e\u0434\u043d\u044b\u0439 \u0443\u0440\u043e\u043a \u043f\u043e Mediapipe<\/u><\/a>, \u0433\u0434\u0435 \u043c\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b Mediapipe.<\/p>\n<p><strong>Mediapipe \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u00a0<\/strong><a href=\"https:\/\/google.github.io\/mediapipe\/solutions\/face_mesh.html\" rel=\"noopener noreferrer nofollow\"><strong><u>\u041a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u043b\u0438\u0446\u0435\u0432\u043e\u0439 \u0441\u0435\u0442\u043a\u0438<\/u><\/strong><\/a><strong>\u00a0\u043a\u0430\u043a:<\/strong><\/p>\n<blockquote>\n<p><em>\u201c\u041d\u0430\u0448 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 ML \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432\u043c\u0435\u0441\u0442\u0435: \u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043f\u043e\u043b\u043d\u044b\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043b\u0438\u0446\u0430, \u0438 3D-\u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430 \u043b\u0438\u0446\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u044d\u0442\u0438\u043c\u0438 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e 3D-\u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438.\u00a0\u0422\u043e\u0447\u043d\u0430\u044f \u043e\u0431\u0440\u0435\u0437\u043a\u0430 \u043b\u0438\u0446\u0430 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u0432 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f\u0445 \u043a \u0434\u0430\u043d\u043d\u044b\u043c, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0430\u0444\u0444\u0438\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0435 \u0438\u0437 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043e\u0432, \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430.\u00a0\u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0435\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u0432\u043e\u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0446\u0438\u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.\u00a0\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0435 \u043f\u043e\u0441\u0435\u0432\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432 \u043b\u0438\u0446\u0430, \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043a\u0430\u0434\u0440\u0435, \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043b\u0438\u0446\u0430, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440 \u043b\u0438\u0446\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043b\u0438\u0446\u0430 \u201d.<\/em><\/p>\n<\/blockquote>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p><em>\u041a\u0440\u0430\u0441\u043d\u044b\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043e\u0431\u0440\u0435\u0437\u0430\u043d\u043d\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430, \u043a\u0440\u0430\u0441\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442<\/em><strong><em>\u00a0468<\/em><\/strong><em>\u00a0\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432 \u0432 3D, \u0430 \u0437\u0435\u043b\u0435\u043d\u044b\u0435 \u043b\u0438\u043d\u0438\u0438, \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0438\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b, \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442 \u043a\u043e\u043d\u0442\u0443\u0440\u044b \u0432\u043e\u043a\u0440\u0443\u0433 \u0433\u043b\u0430\u0437, \u0431\u0440\u043e\u0432\u0435\u0439, \u0433\u0443\u0431 \u0438 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0446\u0430.<\/em><\/p>\n<p><em>Mediapipe &#8212; \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.\u00a0\u0412\u0430\u0441 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0435 \u043d\u0430\u0448\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u0431\u043b\u043e\u0433\u0435, \u0433\u0434\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 Face Mesh \u0434\u043b\u044f<\/em><a href=\"https:\/\/learnopencv.com\/create-snapchat-instagram-filters-using-mediapipe\/\" rel=\"noopener noreferrer nofollow\"><em><u>\u00a0\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 Snapchat \u0438 Instagram \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Mediapipe<\/u><\/em><\/a><em>.<\/em><\/p>\n<p>\u041a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435, \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043b\u044f\u00a0<strong>\u0441\u0435\u0442\u043a\u0438 \u043b\u0438\u0446<\/strong>\u00a0\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u00a0<strong><em>468<\/em><\/strong>\u00a0\u0442\u043e\u0447\u0435\u043a \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430 \u043d\u0430 \u043b\u0438\u0446\u0435.<\/p>\n<p>\u041d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u0442\u043e\u0447\u0435\u043a.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a:\u00a0<a href=\"https:\/\/github.com\/google\/mediapipe\/tree\/master\/mediapipe\/modules\/face_geometry\/data\" rel=\"noopener noreferrer nofollow\"><u>canonical_face_model_uv_visualization<\/u><\/a>  <\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/strong>\u00a0\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0441\u043d\u044f\u0442\u044b\u0435 \u043a\u0430\u043c\u0435\u0440\u043e\u0439, \u043f\u0435\u0440\u0435\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438.\u00a0\u0418\u0442\u0430\u043a, \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b (\u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0432\u044b\u0448\u0435) \u0432 \u0433\u043b\u0430\u0437\u0443 (\u043e\u0431\u043b\u0430\u0441\u0442\u0438) \u0441\u043b\u0435\u0432\u0430 \u043e\u0442 \u0432\u0430\u0441 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u043e\u0433\u043e \u0433\u043b\u0430\u0437\u0430 \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0444\u043e\u043a\u0443\u0441\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043d\u0430\u00a0<strong><em>\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u0441\u043e\u043d\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f<\/em><\/strong>, \u0438\u0437\u00a0<strong>468<\/strong>\u00a0\u0442\u043e\u0447\u0435\u043a \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0447\u043a\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c \u0433\u043b\u0430\u0437.\u00a0\u041e\u0431\u043b\u0430\u0441\u0442\u0438 \u0433\u043b\u0430\u0437 \u0438\u043c\u0435\u044e\u0442 32 \u0442\u043e\u0447\u043a\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430 (\u043f\u043e 16 \u0442\u043e\u0447\u0435\u043a \u0432 \u043a\u0430\u0436\u0434\u043e\u0439).<em>\u00a0<\/em><strong>\u0414\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f EAR \u043d\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e 12 \u0442\u043e\u0447\u0435\u043a (\u043f\u043e 6 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0433\u043b\u0430\u0437\u0430).<\/strong><\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u0432\u044b\u0448\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u044d\u0442\u0430\u043b\u043e\u043d\u0430, \u0432\u044b\u0431\u0440\u0430\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435\u00a0<strong>12 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432<\/strong>:<\/p>\n<ol>\n<li>\n<p>\u0414\u043b\u044f\u00a0<strong>\u043b\u0435\u0432\u043e\u0433\u043e \u0433\u043b\u0430\u0437\u0430<\/strong>:\u00a0<code>[362, 385, 387, 263, 373, 380]<\/code><\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f\u00a0<strong>\u043f\u0440\u0430\u0432\u043e\u0433\u043e \u0433\u043b\u0430\u0437\u0430<\/strong>:\u00a0<code>[33, 160, 158, 133, 153, 144]<\/code><\/p>\n<\/li>\n<\/ol>\n<p>\u0412\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435:\u00a0<strong><em>P<sub>\u00a01<\/sub>, P<sub>\u00a02<\/sub>, P<sub>\u00a03<\/sub>, P<sub>\u00a04<\/sub>, P<sub>\u00a05<\/sub>, P<sub>\u00a06<\/sub>\u00a0<\/em><\/strong><\/p>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u0442\u043e\u0447\u043a\u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438.\u00a0\u041e\u043d\u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c face mesh.\u00a0\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b\u00a0<em>x<\/em>,\u00a0<em>y<\/em>\u00a0(\u0438\u00a0<em>z<\/em>), \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044e \u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435.<\/p>\n<\/blockquote>\n<p>\u041a\u0430\u043a \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430, \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u00a0<strong><em>\u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u043b\u0438\u0446<\/em><\/strong>\u00a0\u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043c\u043e\u0434\u0435\u043b\u044c\u044e\u00a0<strong><em>\u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u043b\u0438\u0446\u0435\u0432\u044b\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432<\/em><\/strong>.\u00a0\u0414\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u043b\u0438\u0446 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u00a0<em>\u043c\u043e\u0434\u0435\u043b\u044c BlazeFace, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u043c\u0435\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u0430.<\/em><\/p>\n<p>\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u043b\u0438\u0446 &#8212; \u043e\u0447\u0435\u043d\u044c \u0433\u043e\u0440\u044f\u0447\u0430\u044f \u0442\u0435\u043c\u0430 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f.\u00a0\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u043e\u0447\u044c \u043d\u0430\u0448\u0438\u043c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c \u043b\u0435\u0433\u043a\u043e \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043e\u0447\u0435\u043d\u044c\u00a0<a href=\"https:\/\/learnopencv.com\/what-is-face-detection-the-ultimate-guide\/\" rel=\"noopener noreferrer nofollow\"><strong><em><u>\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044e \u043b\u0438\u0446<\/u><\/em><\/strong><\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0433\u0438\u0433\u0430\u043d\u0442\u044b \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435.<\/p>\n<p><a class=\"anchor\" name=\"3.1.\" id=\"3.1.\"><\/a><\/p>\n<h3>\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0441 \u043b\u0438\u0446\u0435\u0432\u043e\u0439 \u0441\u0435\u0442\u043a\u043e\u0439<\/h3>\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 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u044b\u0432\u043e\u0434 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c\u00a0<strong>\u0441\u0435\u0442\u043a\u0438 \u043b\u0438\u0446<\/strong>\u00a0\u0438 \u043d\u0430\u043d\u0435\u0441\u0442\u0438 \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a \u0442\u043e\u0447\u043a\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0430 \u043b\u0438\u0446\u0430.  <\/p>\n<pre><code class=\"python\">import cv2 import numpy as np import matplotlib.pyplot as plt import mediapipe as mp   mp_facemesh = mp.solutions.face_mesh mp_drawing  = mp.solutions.drawing_utils denormalize_coordinates = mp_drawing._normalized_to_pixel_coordinates   %matplotlib inline<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b (\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435) \u0442\u043e\u0447\u043a\u0438 \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u0433\u043b\u0430\u0437.  <\/p>\n<pre><code class=\"python\"># Landmark points corresponding to left eye all_left_eye_idxs = list(mp_facemesh.FACEMESH_LEFT_EYE) # flatten and remove duplicates all_left_eye_idxs = set(np.ravel(all_left_eye_idxs))    # Landmark points corresponding to right eye all_right_eye_idxs = list(mp_facemesh.FACEMESH_RIGHT_EYE) all_right_eye_idxs = set(np.ravel(all_right_eye_idxs))   # Combined for plotting - Landmark points for both eye all_idxs = all_left_eye_idxs.union(all_right_eye_idxs)   # The chosen 12 points:   P1,  P2,  P3,  P4,  P5,  P6 chosen_left_eye_idxs  = [362, 385, 387, 263, 373, 380] chosen_right_eye_idxs = [33,  160, 158, 133, 153, 144] all_chosen_idxs = chosen_left_eye_idxs + chosen_right_eye_idxs<\/code><\/pre>\n<p> \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c API \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432 \u043d\u0430 \u043e\u0431\u0440\u0430\u0437\u0446\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<strong>:<\/strong>  <\/p>\n<pre><code class=\"python\"># load the image image = cv2.imread(r\"test-open-eyes.jpg\") image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) #<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-342143","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/342143","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=342143"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/342143\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=342143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=342143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=342143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}