{"id":303491,"date":"2020-05-13T09:00:44","date_gmt":"2020-05-13T09:00:44","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=303491"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=303491","title":{"rendered":"\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439 eye-tracking \u043d\u0430 PyTorch"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/501412\/\">\n<p>\u0420\u044b\u043d\u043e\u043a eye-tracking&#8217;\u0430, \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f, \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0442\u0438 \u0438 \u0440\u0430\u0441\u0442\u0438: \u0441 $560 \u043c\u043b\u043d \u0432 2020 \u0434\u043e $1,786 \u043c\u043b\u0440\u0434 \u0432 <a href=\"https:\/\/www.marketsandmarkets.com\/Market-Reports\/eye-tracking-market-144268378.html\" rel=\"nofollow\">2025<\/a>. \u0422\u0430\u043a \u043a\u0430\u043a\u0430\u044f \u0435\u0441\u0442\u044c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u0440\u043e\u0433\u0438\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c? \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0432\u0435\u0431\u043a\u0430! \u041a\u0430\u043a \u0438 \u0434\u0440\u0443\u0433\u0438\u0435, \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0431\u0443\u0434\u044c \u0442\u043e: \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 (\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u0432\u0441\u0435\u0445 \u043a\u0430\u043c\u0435\u0440\u0430\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e), \u0441\u0438\u043b\u044c\u043d\u0430\u044f \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 (\u043e\u0442 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u0434\u043e \u043d\u0430\u043a\u043b\u043e\u043d\u0430 \u043a\u0430\u043c\u0435\u0440\u044b \u0438 \u0435\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438\u0446\u0430), \u043f\u043e\u0440\u044f\u0434\u043e\u0447\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438 (\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e cuda-\u044f\u0434\u0435\u0440 \u0438 Xeon \u2014 \u0441\u0430\u043c\u043e\u0435 \u0442\u043e)&#8230;<\/p>\n<p>  <\/p>\n<p>\u0425\u043e\u0442\u044f \u043f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435-\u043a\u0430, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u043d\u0430\u0434\u043e \u0442\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u043e\u043f\u043e\u0432\u043e\u0435 \u0436\u0435\u043b\u0435\u0437\u043e \u0434\u0430 \u0435\u0449\u0435 \u0438 \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0440\u0442\u0443 \u0437\u0430\u043a\u0443\u043f\u0430\u0442\u044c? \u041c\u043e\u0436\u0435\u0442, \u0435\u0441\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043d\u0430 cpu \u0438 \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438?<\/p>\n<p>  <\/p>\n<p>(Well, \u0435\u0441\u043b\u0438 \u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430, \u0442\u043e \u043d\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e \u0442\u043e, \u043a\u0430\u043a \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u0439\u0440\u043e\u043d\u043a\u0443 \u043d\u0430 PyTorch)<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h1 id=\"dannye\">\u0414\u0430\u043d\u043d\u044b\u0435<\/h1>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430 \u0432 data science, \u0441\u0430\u043c\u044b\u0439 \u0432\u0430\u0436\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441. \u0421\u043f\u0443\u0441\u0442\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0438\u0441\u043a\u043e\u0432 \u044f \u043d\u0430\u0448\u0435\u043b \u0434\u0430\u0442\u0430\u0441\u0435\u0442 <strong>MPIIGaze<\/strong>. \u0410\u0432\u0442\u043e\u0440\u044b <a href=\"https:\/\/arxiv.org\/pdf\/1711.09017.pdf\" rel=\"nofollow\">\u0441\u0442\u0430\u0442\u044c\u0438<\/a> \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0438 \u043c\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431 \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0433\u043e\u043b\u043e\u0432\u044b), \u043d\u043e \u043c\u044b \u043f\u043e\u0439\u0434\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043f\u0443\u0442\u0435\u043c.<\/p>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c <a href=\"http:\/\/colab.research.google.com\" rel=\"nofollow\">Colab<\/a>, \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043d\u043e\u0443\u0442\u0431\u0443\u043a \u0438 \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0438\u043c\u043f\u043e\u0440\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a import os  import numpy as np import pandas as pd import scipy import scipy.io  from PIL import Image import cv2  import seaborn as sns import matplotlib import matplotlib.pyplot as plt<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 Colab&#8217;\u0435 \u043c\u043e\u0436\u043d\u043e \u044e\u0437\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430, \u0441\u043e\u0443, \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0438 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">!wget https:\/\/datasets.d2.mpi-inf.mpg.de\/MPIIGaze\/MPIIGaze.tar.gz !tar xvzf MPIIGaze.tar.gz MPIIGaze<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0430\u043f\u043a\u0435 <em>Data\/Original<\/em> \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0438\u0445 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u0432. \u0412\u0441\u0435\u0433\u043e \u0438\u0445 \u0431\u044b\u043b\u043e 15, \u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0434\u043d\u0435\u0439 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430. \u041f\u0430\u043f\u043a\u0430 <em>Annotation Subset<\/em> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u043a \u043a\u0430\u0436\u0434\u043e\u0439 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438, \u043a\u0430\u0436\u0434\u0430\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f \u2014 \u043d\u0430\u0431\u043e\u0440 \u043b\u0438\u0446\u0435\u0432\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u0438 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0437\u0440\u0430\u0447\u043a\u043e\u0432 \u043d\u0430 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438. \u0410\u0432\u0442\u043e\u0440\u044b \u0441\u0442\u0430\u0442\u044c\u0438 \u0437\u0430\u0431\u043e\u0442\u043b\u0438\u0432\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0438\u0445 \u0431\u0435\u0437 header&#8217;\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0435\u0439\u0447\u0430\u0441 \u0431\u0443\u0434\u0435\u043c \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0447\u0438\u0441\u0435\u043b\u043a\u0438 \u043a\u0430\u043a\u0438\u043c \u043b\u0438\u0446\u0435\u0432\u044b\u043c \u0442\u043e\u0447\u043a\u0430\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442. <\/p>\n<p>  <\/p>\n<pre><code class=\"python\">database_path = &quot;\/content\/MPIIGaze&quot;  # \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439 \u043e\u0434\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 def load_image_data(patient_name):     global database_path      annotation_path = os.path.join(database_path, &quot;Annotation Subset&quot;, patient_name + &quot;.txt&quot;)     data_folder = os.path.join(database_path, &quot;Data&quot;, &quot;Original&quot;, patient_name)      annotation = pd.read_csv(annotation_path, sep=&quot; &quot;, header=None)      points = np.array(annotation.loc[:, list(range(1, 17))])      filenames = np.array(annotation.loc[:, [0]]).reshape(-1)     images = [np.array(Image.open(os.path.join(data_folder, filename))) for filename in filenames]      return images, points<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">images, points = load_image_data(&quot;p00&quot;)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">plt.imshow(images[0]) colors = [&quot;r&quot;, &quot;g&quot;, &quot;b&quot;, &quot;magenta&quot;, &quot;y&quot;, &quot;cyan&quot;, &quot;brown&quot;, &quot;lightcoral&quot;] for i in range(0, len(points[0]), 2):     x, y = points[0, i:i+2] # \u0432\u043e\u0442 \u0442\u0443\u0442\u044c \u043c\u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0442\u043e\u0447\u0435\u043a \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043f\u043e 2, \u043f\u0440\u0438\u0447\u0435\u043c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 X, Y     plt.scatter([x], [y], c=colors[i\/\/2])<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043a\u0440\u0430\u0441\u0430\u0432\u0435\u0446:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fb\/6j\/0a\/fb6j0aj3w9sojnatl8izlymmkl0.png\"><\/p>\n<p>  <\/p>\n<p>\u0410\u0433\u0430\u0441\u044c, \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u043f\u043e\u0440\u044f\u0434\u043e\u043a: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0440\u0430\u0439\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u043f\u0440\u0430\u0432\u043e\u0433\u043e \u0433\u043b\u0430\u0437\u0430, \u0437\u0430\u0442\u0435\u043c \u043a\u0440\u0430\u0439\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u043b\u0435\u0432\u043e\u0433\u043e \u0433\u043b\u0430\u0437\u0430, \u043f\u043e\u0442\u043e\u043c \u0440\u043e\u0442 \u0438 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0430\u0432\u044b\u0439 \u0438 \u043b\u0435\u0432\u044b\u0439 \u0437\u0440\u0430\u0447\u043a\u0438.<\/p>\n<p>  <\/p>\n<p>\u041e\u043a\u0435\u0439, \u0433\u0440\u0443\u0437\u0438\u043c \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0440\u0430\u0439\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0433\u043b\u0430\u0437\u0430, \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435: \u043f\u0443\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0433\u043b\u0430\u0437 (\u043d\u0443, \u0438 \u0447\u0430\u0441\u0442\u044c \u043b\u0438\u0446\u0430, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f), \u0442\u043e\u0433\u0434\u0430 \u0448\u0438\u0440\u0438\u043d\u0430 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0435\u0435 \u0432\u044b\u0441\u043e\u0442\u0435, \u043a\u0430\u043a 2:1. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0440\u0435\u0437\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a 2 \u043a 1 \u0438\u0437 \u0442\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0438\u043c\u0435\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0442\u043e\u0447\u043a\u0430\u043c\u0438 def distance(x1, y1, x2, y2):     return int(((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5)  image_shape = (16, 32)  # \u0437\u0434\u0435\u0441\u044c \u0432\u044b\u0440\u0435\u0437\u0430\u0435\u043c \u0438\u0437 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0433\u043b\u0430\u0437 \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0440\u0430\u0447\u043a\u0430 # \u044d\u0442\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043f\u043e\u0437\u0436\u0435 def handle_eye(image, p1, p2, pupil):     global image_shape      line_len = distance(*p1, *p2)     # x, y -&gt; y, x     p1 = p1[::-1]     p2 = p2[::-1]     pupil = pupil[::-1]      corner1 = p1 - np.array([line_len\/\/4, 0])     corner2 = p2 + np.array([line_len\/\/4, 0])      sub_image = image[corner1[0]:corner2[0]+1, corner1[1]:corner2[1]+1]      pupil_new = pupil - corner1     pupil_new = pupil_new \/ sub_image.shape[:2]      sub_image = cv2.resize(sub_image, image_shape[::-1], interpolation=cv2.INTER_AREA)     sub_image = cv2.cvtColor(sub_image, cv2.COLOR_RGB2GRAY)      return sub_image, pupil_new<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430 \u043e\u0434\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0443 \u043d\u0430\u0441 2 \u0433\u043b\u0430\u0437\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u2014 \u0435\u0449\u0435 \u043e\u0434\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def image_to_train_data(image, points):     eye_right_p1 = points[0:2]     eye_right_p2 = points[2:4]     eye_right_pupil = points[12:14]      right_image, right_pupil = handle_eye(image, eye_right_p1, eye_right_p2, eye_right_pupil)      eye_left_p1 = points[4:6]     eye_left_p2 = points[6:8]     eye_left_pupil = points[14:16]      left_image, left_pupil = handle_eye(image, eye_left_p1, eye_left_p2, eye_left_pupil)      return right_image, right_pupil, left_image, left_pupil<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c (\u0438 \u043d\u0430 \u043d\u0430\u0441 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u044f\u0442 \u0432 \u043e\u0442\u0432\u0435\u0442):<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043e\u0434\u043d\u0443 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 right_image, right_pupil, left_image, left_pupil = image_to_train_data(images[10], points[10])  plt.imshow(right_image, cmap=&quot;gray&quot;)  r_p_x = int(right_pupil[1] * image_shape[1]) r_p_y = int(right_pupil[0] * image_shape[0]) plt.scatter([r_p_x], [r_p_y], c=&quot;red&quot;)<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bh\/yd\/6x\/bhyd6xkn1wzv_q4ggpqpn4bysuq.png\"><\/p>\n<p>  <\/p>\n<p>\u041d\u0443, \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430 \u0438\u0441\u0442\u0438\u043d\u0443. \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u0432\u0441\u0435\u0445 \u043b\u044e\u0434\u0435\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">images_left_conc = [] images_right_conc = [] pupils_left_conc = [] pupils_right_conc = []  patients_path = os.path.join(database_path, &quot;Data&quot;, &quot;Original&quot;) for patient in os.listdir(patients_path):     print(patient)     images, points = load_image_data(patient)     for i in range(len(images)):         signle_image_data = image_to_train_data(images[i], points[i])          if any(stuff is None for stuff in signle_image_data):             continue          right_image, right_pupil, left_image, left_pupil = signle_image_data          if any(right_pupil &lt; 0) or any(left_pupil &lt; 0):             continue          images_right_conc.append(right_image)         images_left_conc.append(left_image)         pupils_right_conc.append(right_pupil)         pupils_left_conc.append(left_pupil)  images_left_conc = np.array(images_left_conc) images_right_conc = np.array(images_right_conc) pupils_left_conc = np.array(pupils_left_conc) pupils_right_conc = np.array(pupils_right_conc)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">images_left_conc = images_left_conc \/ 255 images_right_conc = images_right_conc \/ 255<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0445\u0438\u0442\u0440\u044b\u0439 \u0442\u0440\u044e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u043a\u043e\u0441\u044b\u0445 \u043b\u044e\u0434\u044f\u0445: \u0443\u0441\u0440\u0435\u0434\u043d\u0438\u043c \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043b\u0435\u0432\u043e\u0433\u043e \u0438 \u043f\u0440\u0430\u0432\u043e\u0433\u043e \u0437\u0440\u0430\u0447\u043a\u043e\u0432 \u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0443\u0441\u0440\u0435\u0434\u043d\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">pupils_conc = np.zeros_like(pupils_left_conc) for i in range(2):     pupils_conc[:, i] = (pupils_left_conc[:, i] + pupils_right_conc[:, i]) \/ 2<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0437\u0440\u0430\u0447\u043a\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">viz_pupils = np.zeros(image_shape) for y, x in pupils_conc:     y = int(y * image_shape[0])     x = int(x * image_shape[1])     viz_pupils[y, x] += 1 max_val = viz_pupils.max() viz_pupils = viz_pupils \/ max_val  plt.imshow(viz_pupils, cmap=&quot;hot&quot;)<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/7p\/mc\/q9\/7pmcq9m4ges7od0ykdy33d2tr8u.png\"><\/p>\n<p>  <\/p>\n<p>\u0410\u0433\u0430, \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u043a\u043e\u043b\u043e \u0446\u0435\u043d\u0442\u0440\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438. <\/p>\n<p>  <\/p>\n<h1 id=\"predobrabotka\">\u041f\u0440\u0435\u0434\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/h1>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043a\u0443\u0441\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u0447\u0435\u043a from sklearn.model_selection import train_test_split  import torch from torch.utils.data import DataLoader, TensorDataset<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044e\u0449\u0430\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0434\u0432\u0430 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 -- \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 def make_2eyes_datasets(images_left, images_right, pupils, train_size=0.8):     n, height, width = images_left.shape      images_left = images_left.reshape(n, 1, height, width)     images_right = images_right.reshape(n, 1, height, width)      images_left_train, images_left_val, images_right_train, images_right_val, pupils_train, pupils_val = train_test_split(         images_left, images_right, pupils, train_size=train_size     )      def make_dataset(im_left, im_right, pups):         return TensorDataset(             torch.from_numpy(im_left.astype(np.float32)), torch.from_numpy(im_right.astype(np.float32)), torch.from_numpy(pups.astype(np.float32))         )      train_dataset = make_dataset(images_left_train, images_right_train, pupils_train)     val_dataset = make_dataset(images_left_val, images_right_val, pupils_val)      return train_dataset, val_dataset  # \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u043e\u0432 \u0432 \u0434\u0430\u0442\u0430\u043b\u043e\u0430\u0434\u0435\u0440\u044b def make_dataloaders(train_dataset, val_dataset, batch_size=256):     train_dataloader = DataLoader(train_dataset, batch_size=batch_size)     val_dataloader = DataLoader(val_dataset, batch_size=batch_size)      return train_dataloader, val_dataloader<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">batch_size = 256  eyes_datasets = make_2eyes_datasets(images_left_conc, images_right_conc, pupils_conc) eyes_train_loader, eyes_val_loader = make_dataloaders(*eyes_datasets, batch_size=batch_size)<\/code><\/pre>\n<p>  <\/p>\n<h1 id=\"obuchaem-modelku\">\u041e\u0431\u0443\u0447\u0430\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c\u043a\u0443<\/h1>\n<p>  <\/p>\n<pre><code class=\"python\">import torch import torch.nn as nn import torch.nn.functional as F<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\"># \u043c\u043e\u0434\u0443\u043b\u044c, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 `keras.layers.Reshape` class Reshaper(nn.Module):     def __init__(self, target_shape):         super(Reshaper, self).__init__()         self.target_shape = target_shape      def forward(self, input):         return torch.reshape(input, (-1, *self.target_shape))  # \u0441\u0430\u043c\u0430 \u043d\u0435\u0439\u0440\u043e\u043d\u043a\u0430 class EyesNet(nn.Module):     def __init__(self):         super(EyesNet, self).__init__()          # \u0434\u0432\u0430 feature-extractor'\u0430 \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043e\u0439         self.features_left = nn.Sequential(             nn.Conv2d(in_channels=1, out_channels=32, kernel_size=5, stride=2, padding=2),             nn.LeakyReLU(),             nn.Conv2d(in_channels=32, out_channels=64, kernel_size=3, stride=2, padding=1),             nn.LeakyReLU(),             nn.Conv2d(in_channels=64, out_channels=64, kernel_size=3, stride=2, padding=1),             nn.LeakyReLU(),             nn.Conv2d(in_channels=64, out_channels=64, kernel_size=3, stride=2, padding=1),             nn.LeakyReLU(),             nn.Conv2d(in_channels=64, out_channels=64, kernel_size=3, stride=2, padding=1),             nn.LeakyReLU(),             Reshaper([64])         )         self.features_right = nn.Sequential(             nn.Conv2d(in_channels=1, out_channels=32, kernel_size=5, stride=2, padding=2),             nn.LeakyReLU(),             nn.Conv2d(in_channels=32, out_channels=64, kernel_size=3, stride=2, padding=1),             nn.LeakyReLU(),             nn.Conv2d(in_channels=64, out_channels=64, kernel_size=3, stride=2, padding=1),             nn.LeakyReLU(),             nn.Conv2d(in_channels=64, out_channels=64, kernel_size=3, stride=2, padding=1),             nn.LeakyReLU(),             nn.Conv2d(in_channels=64, out_channels=64, kernel_size=3, stride=2, padding=1),             nn.LeakyReLU(),             Reshaper([64])         )         self.fc = nn.Sequential(             nn.Linear(128, 64),             nn.LeakyReLU(),             nn.Linear(64, 16),             nn.LeakyReLU(),             nn.Linear(16, 2),             nn.Sigmoid()         )      def forward(self, x_left, x_right):         # \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u043c \u0434\u0432\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0447\u0435\u0440\u0435\u0437 \u0441\u043b\u043e\u0438 \u0444\u0438\u0447, \u043a\u043e\u043d\u043a\u0430\u0442\u0435\u043d\u0438\u0440\u0443\u0435\u043c \u0438 \u043e\u0442\u0434\u0430\u0435\u043c \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u043e\u0440\u0443         x_left = self.features_left(x_left)         x_right = self.features_right(x_right)         x = torch.cat((x_left, x_right), 1)         x = self.fc(x)          return x<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a \u0441\u043b\u043e\u0432\u0443, \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u043d\u0430 GPU (\u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043b\u044e\u0431\u0430\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430 \u043d\u0430 CPU \u2248 \u0441\u043c\u044d\u0440\u0442\u044c), \u0431\u043b\u0430\u0433\u043e \u041a\u043e\u043b\u0430\u0431 \u0434\u0430\u0435\u0442 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c 8 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u043d\u043a\u0438 def train(model, train_loader, test_loader, epochs, lr, folder=&quot;gazenet&quot;):     os.makedirs(folder, exist_ok=True)      optimizer = torch.optim.Adam(model.parameters(), lr=lr)     mse = nn.MSELoss()      for epoch in range(epochs):         running_loss = 0         error_mean = []         error_std = []         for i, (*xs_batch, y_batch) in enumerate(train_loader):             xs_batch = [x_batch.cuda() for x_batch in xs_batch]             y_batch = y_batch.cuda()              optimizer.zero_grad()              y_batch_pred = model(*xs_batch)             loss = mse(y_batch_pred, y_batch)              loss.backward()             optimizer.step()              running_loss += loss.item()              difference = (y_batch - y_batch_pred).detach().cpu().numpy().reshape(-1)             error_mean.append(np.mean(difference))             error_std.append(np.std(difference))          error_mean = np.mean(error_mean)         error_std = np.mean(error_std)          print(f&quot;Epoch {epoch+1}\/{epochs}, train loss: {running_loss}, error mean: {error_mean}, error std: {error_std}&quot;)          running_loss = 0         error_mean = []         error_std = []         for i, (*xs_batch, y_batch) in enumerate(train_loader):             xs_batch = [x_batch.cuda() for x_batch in xs_batch]             y_batch = y_batch.cuda()              y_batch_pred = model(*xs_batch)             loss = mse(y_batch_pred, y_batch)              loss.backward()             running_loss += loss.item()              difference = (y_batch - y_batch_pred).detach().cpu().numpy().reshape(-1)             error_mean.append(np.mean(difference))             error_std.append(np.std(difference))          error_mean = np.mean(error_mean)         error_std = np.mean(error_std)          print(f&quot;Epoch {epoch+1}\/{epochs}, val loss: {running_loss}, error mean: {error_mean}, error std: {error_std}&quot;)          epoch_path = os.path.join(folder, f&quot;epoch_{epoch+1}.pth&quot;)         torch.save(model.state_dict(), epoch_path)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">eyesnet = EyesNet().cuda() # \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0432\u0435\u0441\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043f\u0430\u043f\u043a\u0443 *eyes_net* train(eyesnet, eyes_train_loader, eyes_val_loader, 300, 1e-3, &quot;eyes_net&quot;)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u043b\u0435 300 \u044d\u043f\u043e\u0445 (\u044f \u043d\u0435 \u043f\u0438\u0441\u0430\u043b \u0441\u0438\u0434\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f):<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Epoch 1\/300, train loss: 0.3125856015831232, error mean: -0.019309822469949722, error std: 0.08668763190507889 Epoch 1\/300, val loss: 0.18365296721458435, error mean: -0.008721884340047836, error std: 0.07283741235733032 Epoch 2\/300, train loss: 0.1700970521196723, error mean: 0.0001489206333644688, error std: 0.07033108174800873 Epoch 2\/300, val loss: 0.1475073655601591, error mean: -0.001808341359719634, error std: 0.06572529673576355 ... Epoch 299\/300, train loss: 0.003378463063199888, error mean: -8.133996743708849e-05, error std: 0.009488753043115139 Epoch 299\/300, val loss: 0.004163481352406961, error mean: -0.001996406354010105, error std: 0.010547727346420288 Epoch 300\/300, train loss: 0.003569353237253381, error mean: -9.1125002654735e-05, error std: 0.00977678969502449 Epoch 300\/300, val loss: 0.004456713928448153, error mean: 0.0008482271223329008, error std: 0.010923181660473347<\/code><\/pre>\n<p>  <\/p>\n<p>299 \u044d\u043f\u043e\u0445\u0430 \u043c\u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0445, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u044e\u0437\u0430\u0435\u043c \u0435\u0435 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<h1 id=\"ocenka-modeli\">\u041e\u0446\u0435\u043d\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0438<\/h1>\n<p>  <\/p>\n<p>\u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import random  # \u0440\u0438\u0441\u0443\u0435\u0442 \u043b\u0435\u0432\u044b\u0439 \u0438 \u043f\u0440\u0430\u0432\u044b\u0439 \u0433\u043b\u0430\u0437 \u0438 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0440\u0430\u0447\u043a\u0430 def show_output(model, data_loader, batch_num=0, samples=5, grid_shape=(5, 1), figsize=(10, 10)):     for i, (*xs, y) in enumerate(data_loader):         if i == batch_num:             break     xs = [x.cuda() for x in xs]     y_pred = model(*xs).detach().cpu().numpy().reshape(-1, 2)      xs = [x.detach().cpu().numpy().reshape(-1, 16, 32) for x in xs]     imgs_conc = np.hstack(xs)     y = y.cpu().numpy().reshape(-1, 2)      indices = random.sample(range(len(y_pred)), samples)     fig, axes = plt.subplots(*grid_shape, figsize=figsize)     for i, index in enumerate(indices):         row = i \/\/ grid_shape[1]         column = i % grid_shape[1]          axes[row, column].imshow(imgs_conc[index])         axes[row, column].scatter([y_pred[index, 1]*32, y_pred[index, 1]*32], [y_pred[index, 0]*16, (y_pred[index, 0]+1)*16], c=&quot;r&quot;)         axes[row, column].scatter([y[index, 1]*32, y[index, 1]*32], [y[index, 0]*16, (y[index, 0]+1)*16], c=&quot;g&quot;)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c 299 \u044d\u043f\u043e\u0445\u0443 eyesnet.load_state_dict(torch.load(&quot;eyes_net\/epoch_299.pth&quot;))  show_output(eyesnet, eyes_val_loader, 103, 16, (4, 4))<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/pf\/4b\/on\/pf4bonqbbbcu9b0glanhmarvhq8.png\"><\/p>\n<p>  <\/p>\n<p>\u041e\u0445, \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u043c\u043d\u0435, \u0447\u0442\u043e &quot;\u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435&quot; \u0442\u043e\u0447\u043a\u0438 \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u044b \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430 \u0437\u0440\u0430\u0447\u043a\u0430, \u043d\u0443 \u0434\u0430 \u043b\u0430\u0434\u043d\u043e. \u0417\u0430\u043a\u0440\u0430\u043b\u0430\u0441\u044c \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u2014 \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0438\u0437-\u0437\u0430 \u0443\u0441\u0440\u0435\u0434\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0434\u0432\u0443\u043c \u0433\u043b\u0430\u0437\u0430\u043c, \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0430 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u043e\u0447\u043d\u0430\u044f. \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u0430\u0442\u0430\u0441\u0435\u0442, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u043e\u0442 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0437\u0440\u0430\u0447\u043a\u0430 (\u043f\u043e X \u0438 Y), \u043a\u0430\u043a \u0432 \u0441\u0442\u0430\u0442\u044c\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def error_distribution(model, data_loader, image_shape=(16, 32), bins=32, digits=2, figsize=(10,10)):     ys_true = []     ys_pred = []     for *xs, y in data_loader:         xs = [x.cuda() for x in xs]         y_pred = model(*xs)          ys_true.append(y.detach().cpu().numpy())         ys_pred.append(y_pred.detach().cpu().numpy())     ys_true = np.concatenate(ys_true)     ys_pred = np.concatenate(ys_pred)     indices = np.arange(len(ys_true))      fig, axes = plt.subplots(2, figsize=figsize)     for ax_num in range(2):         ys_true_subset = ys_true[:, ax_num]         ys_pred_subset = ys_pred[:, ax_num]         counts, ranges = np.histogram(ys_true_subset, bins=bins)          errors = []         labels = []         for i in range(len(counts)):             begin, end = ranges[i], ranges[i + 1]             range_indices = indices[(ys_true_subset &gt;= begin) &amp; (ys_true_subset &lt;= end)]              diffs = np.abs(ys_pred_subset[range_indices] - ys_true_subset[range_indices])             label = (begin + end) \/ 2             if image_shape:                 diffs = diffs * image_shape[ax_num]                 label = label * image_shape[ax_num]             else:                 label = round(label, digits)             errors.append(diffs)             labels.append(str(label)[:2+digits])          axes[ax_num].boxplot(errors, labels=labels)          if image_shape:             y_label = &quot;difference, px&quot;             x_label = &quot;true position, px&quot;         else:             y_label = &quot;difference&quot;             x_label = &quot;true position&quot;         axes[ax_num].set_ylabel(y_label)         axes[ax_num].set_xlabel(x_label)          if ax_num == 0:             title = &quot;Y&quot;         else:             title = &quot;X&quot;         axes[ax_num].set_title(title)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">error_distribution(eyesnet, eyes_val_loader, figsize=(20, 10))<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/le\/_2\/if\/le_2if7ikvv3cvopxbll_pwv9ik.png\"><br \/>  <em>\u0427\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u0437\u0440\u0430\u0447\u043e\u043a \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0448\u0438\u0431\u043a\u0430<\/em><\/p>\n<p>  <\/p>\n<p>\u041e\u043a-\u0441, \u0432\u0440\u043e\u0434\u0435 \u0431\u044b \u0441\u043e\u0439\u0434\u0435\u0442. \u0422\u0435\u043f\u0435\u0440\u044c \u0442\u043e, \u0440\u0430\u0434\u0438 \u0447\u0435\u0433\u043e \u043c\u044b \u0432\u0441\u0435 \u0442\u0443\u0442 \u0441\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0438\u0437\u043c\u0435\u0440\u044f\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0421:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import time  def measure_time(model, data_loader, n_batches=5):     begin_time = time.time()      batch_num = 0     n_samples = 0      predicted = []     for *xs, y in data_loader:         xs = [x.cpu() for x in xs]          y_pred = model(*xs)         predicted.append(y_pred.detach().cpu().numpy().reshape(-1))          batch_num += 1         n_samples += len(y)          if batch_num &gt;= n_batches:             break      end_time = time.time()      time_per_sample = (end_time - begin_time) \/ n_samples     return time_per_sample<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">eyesnet_cpu = EyesNet().cpu() eyesnet_cpu.load_state_dict(torch.load(&quot;eyes_net\/epoch_299.pth&quot;, map_location=&quot;cpu&quot;))  # \u0441\u0434\u0435\u043b\u0430\u0435\u043c dataloader, \u043f\u043e\u0434\u0430\u044e\u0449\u0438\u0439 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u0441\u044d\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 realtime _, eyes_val_loader_single = make_dataloaders(*eyes_datasets, batch_size=1)  tps = measure_time(eyesnet_cpu, eyes_val_loader_single) print(f&quot;{tps} seconds per sample&quot;) &gt;&gt;&gt; 0.003347921371459961 seconds per sample<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u0441\u0435\u0431\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u0435\u0441\u0442\u0438 \u043d\u0435\u0439\u0440\u043e\u043d\u043a\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 VGG16 (\u043d\u0435 \u043e\u0431\u0443\u0447\u0430\u044f, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0433\u043e\u043d\u0438\u043c \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0435 \u0431\u0430\u0442\u0447\u0438):<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import torchvision.models as models  class VGG16Based(nn.Module):     def __init__(self):         super(VGG16Based, self).__init__()          self.vgg = models.vgg16(pretrained=False)         self.vgg.classifier = nn.Sequential(             nn.Linear(25088, 256),             nn.LeakyReLU(),             nn.Linear(256, 2),             nn.Sigmoid()         )      def forward(self, x_left, x_right):         x_mid = (x_left + x_right) \/ 2         x = torch.cat((x_left, x_mid, x_right), dim=1)          # \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u0434\u0434\u0438\u043d\u0433, \u0447\u0442\u043e\u0431\u044b VGG16 \u0441\u043c\u043e\u0433\u043b\u0430 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0444\u0438\u0447\u0438         x_pad = torch.zeros((x.shape[0], 3, 32, 32))         x_pad[:, :, :16, :] = x          x = self.vgg(x_pad)          return x  vgg16 = VGG16Based() vgg16_tps = measure_time(vgg16, eyes_val_loader_single) print(f&quot;{vgg16_tps} seconds per sample&quot;) &gt;&gt;&gt; 0.023713159561157226 seconds per sample<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u044f, \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u043c\u043e\u0435\u043c \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0435 (AMD A10-4600M APU, 1500 MHz):<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">python benchmark.py  0.003980588912963867 seconds per sample, EyesNet 0.12246298789978027 seconds per sample, VGG16-based<\/code><\/pre>\n<p>  <\/p>\n<h1 id=\"vyvody\">\u0412\u044b\u0432\u043e\u0434\u044b<\/h1>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0436, \u043d\u0435\u0439\u0440\u043e\u043d\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c, \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435, \u043f\u0430\u043c\u044f\u0442\u0438 \u0435\u0441\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e (\u0432\u0435\u0441\u0430 \u0434\u043b\u044f VGG16 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 80 \u043c\u0431, \u0430 \u0434\u043b\u044f EyesNet \u2014 1 \u043c\u0431; \u0440\u0430\u0441\u0445\u043e\u0434 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043a\u0438 \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0441\u043e\u0432 \u044f \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0435 \u0441\u043c\u043e\u0433, \u043d\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0445, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c). \u041d\u043e, \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, \u0435\u0441\u0442\u044c \u043a\u0443\u0434\u0430 \u0440\u0430\u0441\u0442\u0438. \u0412\u043e\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0448\u043b\u0438 \u043c\u043d\u0435 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0430\u0442\u0440\u0438\u0446 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 (\u043a\u0430\u043a \u0432 <a href=\"https:\/\/arxiv.org\/pdf\/1711.09017.pdf\" rel=\"nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>).<\/li>\n<li>\u041f\u043e\u0440\u0435\u0437\u0430\u0442\u044c \u0432\u0435\u0441\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c float8 \u0432\u043c\u0435\u0441\u0442\u043e float32 (\u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d, \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442 \u043b\u0438 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043d\u043e \u0432\u043e\u0442 \u043f\u0430\u043c\u044f\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435).<\/li>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c PyTorch Mobile \u2014 \u0432\u0435\u0440\u0441\u0438\u044e PyTorch \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432. \u0422\u0430\u043a\u0436\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u0438 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0443\u0440\u0435\u0437\u0430\u043d\u0438\u044f \u0441\u0430\u043c\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/li>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u0442\u0430\u0441\u0435\u0442 \u043f\u043e\u0431\u043e\u043b\u044c\u0448\u0435. \u041a\u0430\u043a \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442 \u2014 <a href=\"https:\/\/gazecapture.csail.mit.edu\/\" rel=\"nofollow\">GazeCapture<\/a>. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0434\u0430\u0434\u0443\u0442 \u043f\u0440\u044f\u043c\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0434\u0430\u0442\u0430\u0441\u0435\u0442, \u043a\u0438\u043d\u044c\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u044b, \u043f\u043b\u0435\u0437 \u2014 \u043c\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438: \u0421<\/li>\n<li>\u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/www.tensorflow.org\/lite\" rel=\"nofollow\">TFLite<\/a> \u2014 TensorFlow \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432. \u041c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u0436\u0435 \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445!<\/li>\n<\/ol>\n<p>  <\/p>\n<h1 id=\"nemnogo-o-nas\">\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u043d\u0430\u0441<\/h1>\n<p>  <\/p>\n<p>\u0415\u0449\u0435 \u0440\u0430\u0437 \u043f\u0440\u0438\u0432\u0435\u0442, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0415\u0432\u0433\u0435\u043d\u0438\u0439. \u041e\u0431\u043e\u0436\u0430\u044e Data science (\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u2014 \u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c\u043a\u0438 *^*) \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0438\u043c \u043f\u043e\u043b\u0442\u043e\u0440\u0430 \u0433\u043e\u0434\u0430. \u042d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u2014 FARADAY Lab. \u041c\u044b \u2014 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0435 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0435 \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u0435\u0440\u044b \u0438 \u0445\u043e\u0442\u0438\u043c \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0412\u0430\u043c\u0438 \u0442\u0435\u043c, \u0447\u0442\u043e \u0443\u0437\u043d\u0430\u0435\u043c \u0441\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0423\u0434\u0430\u0447\u0438 c:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ms\/1u\/a8\/ms1ua8wsr4u5h1opv3ylaonfq2k.png\"><\/p>\n<p>  <\/p>\n<h2 id=\"poleznye-ssylki\">\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438:<\/h2>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/evjeny\/mobile_eyetracking\" rel=\"nofollow\">\u0440\u0435\u043f\u043e \u0441 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u043e\u043c \u0438 \u043a\u043e\u0434\u043e\u043c \u0434\u043b\u044f \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430<\/a><\/li>\n<li><a href=\"https:\/\/arxiv.org\/pdf\/1711.09017.pdf\" rel=\"nofollow\">\u0441\u0442\u0430\u0442\u044c\u044f \u0430\u0432\u0442\u043e\u0440\u043e\u0432 MPIIGaze<\/a><\/li>\n<li><a href=\"https:\/\/arxiv.org\/pdf\/1606.05814.pdf\" rel=\"nofollow\">\u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438 \u043a\u043b\u0430\u0441\u0441\u043d\u044b\u0439 \u0434\u0430\u0442\u0430\u0441\u0435\u0442<\/a><\/li>\n<li><a href=\"https:\/\/pytorch.org\/mobile\/home\/\" rel=\"nofollow\">PyTorch mobile<\/a><\/li>\n<li><a href=\"https:\/\/www.tensorflow.org\/lite\" rel=\"nofollow\">TensorFlow lite<\/a><\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/501412\/\"> https:\/\/habr.com\/ru\/post\/501412\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/501412\/\">\n<p>\u0420\u044b\u043d\u043e\u043a eye-tracking&#8217;\u0430, \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f, \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0442\u0438 \u0438 \u0440\u0430\u0441\u0442\u0438: \u0441 $560 \u043c\u043b\u043d \u0432 2020 \u0434\u043e $1,786 \u043c\u043b\u0440\u0434 \u0432 <a href=\"https:\/\/www.marketsandmarkets.com\/Market-Reports\/eye-tracking-market-144268378.html\" rel=\"nofollow\">2025<\/a>. \u0422\u0430\u043a \u043a\u0430\u043a\u0430\u044f \u0435\u0441\u0442\u044c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u0440\u043e\u0433\u0438\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c? \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0432\u0435\u0431\u043a\u0430! \u041a\u0430\u043a \u0438 \u0434\u0440\u0443\u0433\u0438\u0435, \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0431\u0443\u0434\u044c \u0442\u043e: \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 (\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u0432\u0441\u0435\u0445 \u043a\u0430\u043c\u0435\u0440\u0430\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e), \u0441\u0438\u043b\u044c\u043d\u0430\u044f \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 (\u043e\u0442 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u0434\u043e \u043d\u0430\u043a\u043b\u043e\u043d\u0430 \u043a\u0430\u043c\u0435\u0440\u044b \u0438 \u0435\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438\u0446\u0430), \u043f\u043e\u0440\u044f\u0434\u043e\u0447\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438 (\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e cuda-\u044f\u0434\u0435\u0440 \u0438 Xeon \u2014 \u0441\u0430\u043c\u043e\u0435 \u0442\u043e)&#8230;<\/p>\n<p>  <\/p>\n<p>\u0425\u043e\u0442\u044f \u043f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435-\u043a\u0430, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u043d\u0430\u0434\u043e \u0442\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u043e\u043f\u043e\u0432\u043e\u0435 \u0436\u0435\u043b\u0435\u0437\u043e \u0434\u0430 \u0435\u0449\u0435 \u0438 \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0440\u0442\u0443 \u0437\u0430\u043a\u0443\u043f\u0430\u0442\u044c? \u041c\u043e\u0436\u0435\u0442, \u0435\u0441\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043d\u0430 cpu \u0438 \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438?<\/p>\n<p>  <\/p>\n<p>(Well, \u0435\u0441\u043b\u0438 \u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430, \u0442\u043e \u043d\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e \u0442\u043e, \u043a\u0430\u043a \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u0439\u0440\u043e\u043d\u043a\u0443 \u043d\u0430 PyTorch)<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-303491","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303491","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=303491"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303491\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=303491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=303491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=303491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}