{"id":356574,"date":"2024-05-20T23:32:32","date_gmt":"2024-05-20T23:32:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=356574"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=356574","title":{"rendered":"<span>Kornia \u2014 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f<\/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<p>\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0414\u043c\u0438\u0442\u0440\u0438\u0439. \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f \u044f\u0432\u043b\u044f\u044e\u0441\u044c \u043c\u0430\u0433\u0438\u0441\u0442\u0440\u0430\u043d\u0442\u043e\u043c \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043a\u0443\u0440\u0441\u0430 \u0432 \u0418\u0422\u041c\u041e. \u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u044b\u043c \u0437\u0440\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u0447\u0430\u043b \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0442\u044b\u0440\u0435 \u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u043e Kornia.  <\/p>\n<p>Kornia \u044d\u0442\u043e open source \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f. \u041e\u043d\u0430   \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 PyTorch \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0431\u044d\u043a\u0435\u043d\u0434\u0430 \u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440 \u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439. \u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u044f\u043b\u0438\u0441\u044c OpenCV, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 Kornia \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u043c, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u0445 \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u0438\u0442. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c Kornia \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0442\u0435\u043c \u0436\u0435 OpenCV, scikit-image \u0438\u043b\u0438 \u0441 Albumentations \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u0430\u0442\u0447\u0430\u043c\u0438, \u0430 \u043d\u0435 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 GPU. \u041e\u0431 \u044d\u0442\u043e\u043c \u0434\u0430\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Albumentations \u0432 \u0441\u0432\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0432\u043e\u0442 <a href=\"https:\/\/habr.com\/ru\/articles\/680514\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a> \u043d\u0430 \u043d\u0435\u0451. \u0422\u0430\u043a\u0436\u0435 \u0438\u0437 \u043b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u043e\u0433\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0438\u0437 Sber AI \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430  \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 faceswap \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043a\u0430\u0434\u0440\u043e\u0432 \u0431\u0430\u0442\u0447\u0430\u043c\u0438 \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0430 \u0447\u0430\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043d\u0430 Kornia, \u0432\u043e\u0442 <a href=\"https:\/\/habr.com\/ru\/companies\/sberbank\/articles\/645919\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a> \u043d\u0430 \u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044e.  <\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e Kornia \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u044b\u043c \u0437\u0440\u0435\u043d\u0438\u0435\u043c:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/opencv.org\/\" rel=\"noopener noreferrer nofollow\">OpenCV<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/scikit-image.org\/\" rel=\"noopener noreferrer nofollow\">Scikit-Image<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/pytorch.org\/vision\/stable\/index.html\" rel=\"noopener noreferrer nofollow\">Torchvision<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/image\" rel=\"noopener noreferrer nofollow\">Tensorflow.image<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/albumentations.ai\/\" rel=\"noopener noreferrer nofollow\">Albumentations<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0438 Kornia \u0432 \u0441\u0432\u043e\u0435\u0439 <a href=\"https:\/\/arxiv.org\/pdf\/1910.02190.pdf\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/43b\/a28\/25f\/43ba2825f349349471358d6ec91e8352.png\" alt=\"\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f\" title=\"\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f\" width=\"988\" height=\"173\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/43b\/a28\/25f\/43ba2825f349349471358d6ec91e8352.png\"\/><\/p>\n<div><figcaption>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u043f\u043e \u0432\u0441\u0435\u043c \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043f\u0443\u043d\u043a\u0442\u0430\u043c \u0441 Kornia \u043c\u043e\u0436\u0435\u0442 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e Tensorflow.image.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0438 Kornia \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0438 <a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/augmentation.html\" rel=\"noopener noreferrer nofollow\">\u0437\u0430\u043c\u0435\u0440\u044b<\/a> \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0430\u0443\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0437\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a.<\/p>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"center\"><strong>Libraries<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"center\"><strong>TorchVision<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"center\"><strong>Albumentations<\/strong><\/p>\n<\/td>\n<td colspan=\"3\" data-colwidth=\"50,50,0\" width=\"50\">\n<p align=\"center\"><strong>Kornia (GPU)<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"center\"><strong>Batch Size<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"center\">1<\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"center\">1<\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"center\">1<\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"center\">32<\/p>\n<\/td>\n<td>\n<p align=\"center\">128<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomPerspective<\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.88\u00b11.82<\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.68\u00b13.60  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.74\u00b12.84  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.37\u00b12.67  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.20\u00b127.00<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">ColorJiggle  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.40\u00b12.88  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">3.58\u00b13.66  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.14\u00b13.85  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.90\u00b124.68  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.83\u00b112.96  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomAffine  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">3.12\u00b15.80  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">2.43\u00b17.11  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">3.01\u00b17.80  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.30\u00b14.39  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.18\u00b16.30<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomVerticalFlip  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.32\u00b10.08  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.34\u00b10.16  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.35\u00b10.82  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.02\u00b10.13  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.01\u00b10.35  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomHorizontalFlip  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.32\u00b10.08  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.34\u00b10.18  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.31\u00b10.59  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.01\u00b10.26  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.01\u00b10.37  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomRotate  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">1.82\u00b14.70  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">1.59\u00b14.33  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">1.58\u00b14.44  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.25\u00b12.09  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.17\u00b15.69  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomCrop  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.09\u00b13.41  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.03\u00b14.94  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">3.84\u00b13.07  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.16\u00b11.17<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.08\u00b19.42  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomErasing  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">2.31\u00b11.47  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">1.89\u00b11.08  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">2.32\u00b13.31  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.44\u00b12.82  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.57\u00b19.74  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomGrayscale  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.41\u00b10.18  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.43\u00b10.60  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.45\u00b11.20<\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.03\u00b10.11  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.03\u00b17.10  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomResizedCrop  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.23\u00b12.86  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">3.80\u00b13.61  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.07\u00b12.67  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.23\u00b15.27  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.13\u00b18.04  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">CenterCrop  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">2.93\u00b11.29  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">2.81\u00b11.38  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">2.88\u00b12.34  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.13\u00b12.20  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.07\u00b19.41  <\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e Kornia \u0434\u0435\u043b\u0430\u0435\u0442 \u0430\u0443\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u0430\u0442\u0447\u0430\u043c\u0438. \u0415\u0441\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435, \u0442\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043f\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043d\u0435\u0442.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0432\u0445\u043e\u0434\u044f\u0442 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 Kornia.<\/p>\n<p><strong>\u041c\u043e\u0434\u0443\u043b\u0438 Kornia:<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/augmentation.html\" rel=\"noopener noreferrer nofollow\">kornia.augmentation<\/a> &#8212; \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0430\u0443\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/color.html\" rel=\"noopener noreferrer nofollow\">kornia.color<\/a> &#8212; \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 (rgb to grayscale, rgb to bgr \u0438 \u0442.\u0434.).<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/contrib.html\" rel=\"noopener noreferrer nofollow\">kornia.contrib<\/a> &#8212; \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438. \u0415\u0441\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u0438 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0434\u0435\u0442\u0435\u043a\u0446\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0435\u0441\u0442\u044c MobileViT, TinyViT.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/enhance.html\" rel=\"noopener noreferrer nofollow\">kornia.enhance<\/a> &#8212; \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044f\u0440\u043a\u043e\u0441\u0442\u0438, \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0440\u0435\u0437\u043a\u043e\u0441\u0442\u0438 \u0438 \u0442.\u0434. \u0415\u0441\u0442\u044c \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 CLAHE.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/feature.html\" rel=\"noopener noreferrer nofollow\">kornia.feature<\/a> &#8212; \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u043a\u0446\u0438\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0443\u0433\u043b\u043e\u0432, \u043b\u0438\u043d\u0438\u0439 \u0438 \u0442.\u0434. \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/filters.html#\" rel=\"noopener noreferrer nofollow\">kornia.filters <\/a>&#8212; \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u043c\u044b\u0442\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u043d\u0438\u0446 (Canny, Sobel \u0438 \u0442.\u0434.). <\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/geometry.html\" rel=\"noopener noreferrer nofollow\">kornia.geometry<\/a> &#8212; \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439: \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435, \u0441\u0434\u0432\u0438\u0433, \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438 \u0442.\u0434.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/sensors.html\" rel=\"noopener noreferrer nofollow\">kornia.sensors<\/a> &#8212; \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u0438\u0434\u0435\u043e \u043a\u0430\u043c\u0435\u0440\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/io.html\" rel=\"noopener noreferrer nofollow\">kornia.io<\/a> &#8212; \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 kornia_rs, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Rust. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 Linux.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/image.html\" rel=\"noopener noreferrer nofollow\">kornia.image<\/a> &#8212; \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u043c\u043e\u0434\u0443\u043b\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0430\u043d\u0430\u043b\u043e\u0432, \u0444\u043e\u0440\u043c\u0430\u0442 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0438\u0437 \u0444\u0430\u0439\u043b\u0430, \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0432 torch tensor \u0438\u0437 numpy array \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0438 \u0442.\u0434. <\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/losses.html\" rel=\"noopener noreferrer nofollow\">kornia.losses<\/a> &#8212; \u043c\u043e\u0434\u0443\u043b\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/metrics.html\" rel=\"noopener noreferrer nofollow\">kornia.metrics<\/a> &#8212; \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043c\u0435\u0442\u0440\u0438\u043a (accuracy, mean_iou \u0438 \u0442.\u0434.).<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/morphology.html\" rel=\"noopener noreferrer nofollow\">kornia.morphology<\/a> &#8212; \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u043c\u043e\u0440\u0444\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439:\u00a0\u0441\u0443\u0436\u0435\u043d\u0438\u0435 (erosion),\u00a0\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 (dilation),\u00a0\u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 (opening),\u00a0\u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 (closing) \u0438 \u0442.\u0434..<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/tracking.html\" rel=\"noopener noreferrer nofollow\">kornia.tracking<\/a>  \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u0434\u0440\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/testing.html\" rel=\"noopener noreferrer nofollow\">kornia.testing<\/a> &#8212; \u043c\u043e\u0434\u0443\u043b\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0441\u0435\u0439\u0447\u0430\u0441 \u0438\u0445 \u0442\u0430\u043c \u0432\u0441\u0435\u0433\u043e \u0442\u0440\u0438).<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/utils.html\" rel=\"noopener noreferrer nofollow\">kornia.utils<\/a> &#8212; \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u043b\u0438\u043d\u0438\u0439, \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432, \u0432\u044b\u043f\u0443\u043a\u043b\u044b\u0445 \u043c\u043d\u043e\u0433\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043e\u0431\u043b\u0430\u043a\u043e\u0432 \u0442\u043e\u0447\u0435\u043a \u0438 \u0442.\u0434. <\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/x.html\" rel=\"noopener noreferrer nofollow\">kornia.x<\/a> &#8212; \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435  API \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0432 Kornia. \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438 \u0434\u0435\u0442\u0435\u043a\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. <\/p>\n<\/li>\n<\/ul>\n<p>Kornia \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043e\u0431\u0448\u0438\u0440\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0435\u0451 \u043c\u043e\u0434\u0443\u043b\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0438 \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e. \u0420\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431\u043e \u0432\u0441\u0451\u043c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043b\u0438\u0448\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 Kornia.<\/p>\n<p><strong>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/strong><\/p>\n<p>\u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c :<\/p>\n<pre><code>pip install kornia<\/code><\/pre>\n<p>\u041b\u0438\u0431\u043e, \u0435\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0433\u0438\u0442\u0445\u0430\u0431\u0430:<\/p>\n<pre><code>pip install git+https:\/\/github.com\/kornia\/kornia<\/code><\/pre>\n<p> \u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c kornia.io \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438\/\u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c kornia_rs, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Rust. \u041d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 kornia_rs \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 Linux.<\/p>\n<pre><code>pip install kornia_rs<\/code><\/pre>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0435\u0441\u043b\u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 Training API, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0435\u0449\u0451 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c kornia[x].<\/p>\n<pre><code>pip install kornia[x]<\/code><\/pre>\n<h3>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Kornia<\/h3>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Kornia, \u0430 \u043f\u043e\u0442\u043e\u043c \u0443\u0436\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c. \u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/8b7\/e4c\/11a\/8b7e4c11a115c94b87648aa9657f66cd.jpg\" alt=\"\u0418\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\" title=\"\u0418\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\" width=\"925\" height=\"617\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8b7\/e4c\/11a\/8b7e4c11a115c94b87648aa9657f66cd.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u0418\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/figcaption><\/div>\n<\/figure>\n<p><strong>kornia.color<\/strong><\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0446\u0432\u0435\u0442\u043e\u0432\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u0441\u0435\u0440\u044b\u043c.<\/p>\n<pre><code># \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 def load_torch_image(file_name):     image = K.image_to_tensor(cv2.imread(file_name), False).float() \/ 255     image = K.color.bgr_to_rgb(image)     return image   # \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0441\u043e\u0432\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0432 \u043e\u0434\u043d\u043e (\u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438). def concat_images_h(image1, image2):     image1 = transforms.ToPILImage()(torch.squeeze(image1))     image2 = transforms.ToPILImage()(torch.squeeze(image2))     concatenated_images = Image.new('RGB', (image1.width + image2.width, image1.height))     concatenated_images.paste(image1, (0, 0))     concatenated_images.paste(image2, (image1.width, 0))     return concatenated_images   # \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. image_1 = load_torch_image(\"image_sea.jpg\")  # \u041f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0435\u0440\u044b\u0439 \u0446\u0432\u0435\u0442. image_gray = K.color.rgb_to_grayscale(image_1)  # \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438 \u0435\u0433\u043e \u0441\u0435\u0440\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432 \u043e\u0434\u043d\u0443 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443. concatenated_images_contrast = concat_images_h(image_1, image_gray)<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/236\/c5a\/8ff\/236c5a8ff2669cfe8531d385fb44ae55.jpg\" alt=\"\" title=\"\" width=\"1850\" height=\"617\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/236\/c5a\/8ff\/236c5a8ff2669cfe8531d385fb44ae55.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e \u0444\u0438\u043b\u044c\u0442\u0440 Sepia.<\/p>\n<pre><code>image_sepia = K.color.Sepia(rescale=False)(image_1)  concatenated_image_sepia = concat_images_h(image_1, image_sepia)<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/47b\/dd0\/d05\/47bdd0d05baed30a61a43a62f5602581.jpg\" width=\"1850\" height=\"617\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/47b\/dd0\/d05\/47bdd0d05baed30a61a43a62f5602581.jpg\" data-blurred=\"true\"\/><\/figure>\n<p><strong>kornia.enhance<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442. <\/p>\n<pre><code># \u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442. image_contrast = K.enhance.adjust_contrast(image_1, 1.5)  concatenated_images_contrast = concat_images_h(image_1, image_contrast)<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/740\/871\/9c7\/7408719c7c809beed3848e6cfeea3767.jpg\" width=\"1850\" height=\"617\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/740\/871\/9c7\/7408719c7c809beed3848e6cfeea3767.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0438\u043b\u044c\u0442\u0440\u0430 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Adaptive_histogram_equalization\" rel=\"noopener noreferrer nofollow\">CLAHE<\/a>.<\/p>\n<pre><code># \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440 CLAHE \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e. image_clahe = K.enhance.equalize_clahe(image_1)  concatenated_images_clahe = concat_images_h(image_1, image_clahe)  save_tensor_as_image('concatenated_images_clahe.jpg', concatenated_images_clahe)<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/3c8\/504\/248\/3c8504248e3e8355c26642271b2303d1.jpg\" width=\"1850\" height=\"617\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3c8\/504\/248\/3c8504248e3e8355c26642271b2303d1.jpg\" data-blurred=\"true\"\/><\/figure>\n<p><strong>kornia.filters<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0439\u0434\u0435\u043c \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Canny_edge_detector\" rel=\"noopener noreferrer nofollow\">Canny<\/a>.<\/p>\n<pre><code># \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c Canny \u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e. image_canny = K.filters.canny(image_1)[0]  concatenated_images_canny = concat_images_h(image_1, image_canny)<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/c4c\/a68\/ebe\/c4ca68ebe1b3dec44ed31cd24ef56478.jpg\" width=\"1850\" height=\"617\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c4c\/a68\/ebe\/c4ca68ebe1b3dec44ed31cd24ef56478.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A0%D0%B0%D0%B7%D0%BC%D1%8B%D1%82%D0%B8%D0%B5_%D0%BF%D0%BE_%D0%93%D0%B0%D1%83%D1%81%D1%81%D1%83\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u0437\u043c\u044b\u0442\u0438\u0435 \u0413\u0430\u0443\u0441\u0441\u0430<\/a>.<\/p>\n<pre><code># \u0424\u0438\u043b\u044c\u0442\u0440 \u0413\u0430\u0443\u0441\u0441\u0430. gaussian_blur = K.filters.GaussianBlur2d((5, 5), (4.5, 4.5))  # \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440 \u0413\u0430\u0443\u0441\u0441\u0430 \u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e. image_gaussian_blur = gaussian_blur(image_1)  concatenated_images_gaussian_blur = concat_images_h(image_1, image_gaussian_blur)<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u044b\u0442\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/f2e\/d84\/450\/f2ed84450ecef5051072139687043f9c.jpg\" width=\"1850\" height=\"617\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f2e\/d84\/450\/f2ed84450ecef5051072139687043f9c.jpg\" data-blurred=\"true\"\/><\/figure>\n<p><strong>kornia.losses<\/strong><\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0447\u0443 \u0437\u0430\u043e\u0441\u0442\u0440\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 Kornia \u0435\u0441\u0442\u044c \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u0430\u0440\u044b \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043e\u0448\u0438\u0431\u043e\u043a. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043e \u0448\u0435\u0441\u0442\u044c \u043b\u043e\u0441\u0441-\u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u042f \u0438\u0445 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044e.<\/p>\n<ul>\n<li>\n<p>binary_focal_loss_with_logits<\/p>\n<\/li>\n<li>\n<p>focal_loss<\/p>\n<\/li>\n<li>\n<p>dice_loss<\/p>\n<\/li>\n<li>\n<p>tversky_loss  <\/p>\n<\/li>\n<li>\n<p>lovasz_hinge_loss<\/p>\n<\/li>\n<li>\n<p>lovasz_softmax_loss<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0448\u0438\u0431\u043a\u0438 \u0441\u0430\u043c\u043e\u043c\u0443, \u043d\u043e \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u043e\u043d\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442, \u0437\u0430\u0447\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434?<\/p>\n<p><strong>kornia.utils<\/strong><\/p>\n<p>Kornia \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445 \u043b\u0438\u043d\u0438\u0438 \u0438 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438. \u041d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a.<\/p>\n<pre><code>image_with_rectangle = K.utils.draw_rectangle(image_1, torch.tensor([[[10, 10, 400, 400]]]),                                               color=torch.tensor([1,0, 255]), fill=None)<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/14d\/04e\/ea6\/14d04eea6162ce3dddf659fef62161fd.jpg\" width=\"925\" height=\"617\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/14d\/04e\/ea6\/14d04eea6162ce3dddf659fef62161fd.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u043b\u0438\u043d\u0438\u044e.<\/p>\n<pre><code>image_with_line = K.utils.draw_line(torch.squeeze(image_1),                                     torch.tensor([10, 10]),                                     torch.tensor([500, 250]),                                     torch.tensor([1,0,255]))<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/3cd\/fa3\/aaa\/3cdfa3aaa4b4e97872af2f411994e4e2.jpg\" width=\"925\" height=\"617\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3cd\/fa3\/aaa\/3cdfa3aaa4b4e97872af2f411994e4e2.jpg\" data-blurred=\"true\"\/><\/figure>\n<p><strong>kornia.morphology<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e \u043c\u043e\u0440\u0444\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438: \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442, \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435, \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435. \u0415\u0441\u0442\u044c \u0434\u0432\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043c\u043e\u0440\u0444\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438: \u044d\u0440\u043e\u0437\u0438\u044f \u0438 \u0434\u0438\u043b\u0430\u0442\u0430\u0446\u0438\u044f. \u0413\u0440\u0430\u0434\u0438\u0435\u043d\u0442, \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u0445 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u043c\u0438 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f\u043c\u0438.<\/p>\n<pre><code>kernel = torch.tensor([[0, 1, 0], [1, 1, 1], [0, 1, 0]])  # \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430 \u044d\u0442\u043e \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u044d\u0440\u043e\u0437\u0438\u0438 \u0438 \u0434\u0438\u043b\u0430\u0442\u0430\u0446\u0438\u0438. graded_image = K.morphology.gradient(image_1, kernel)<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/72a\/ed7\/e1d\/72aed7e1d9c14918452a16d8a49d5981.jpg\" width=\"925\" height=\"617\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/72a\/ed7\/e1d\/72aed7e1d9c14918452a16d8a49d5981.jpg\" data-blurred=\"true\"\/><\/figure>\n<pre><code># \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u044d\u0440\u043e\u0437\u0438\u0438, \u0430 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0451 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u0438\u043b\u0430\u0442\u0430\u0446\u0438\u0438. opened_image = K.morphology.opening(image_1, kernel)<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/023\/5d1\/4cb\/0235d14cbcdbfa7600d9bd31d555ae3d.jpg\" width=\"925\" height=\"617\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/023\/5d1\/4cb\/0235d14cbcdbfa7600d9bd31d555ae3d.jpg\" data-blurred=\"true\"\/><\/figure>\n<pre><code># \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u0438\u043b\u0430\u0442\u0430\u0446\u0438\u0438, \u0430 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0451 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u044d\u0440\u043e\u0437\u0438\u0438. closed_image = K.morphology.closing(image_1, kernel)<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/260\/7ed\/c6d\/2607edc6d0eb77befe73d852f8e62848.jpg\" width=\"925\" height=\"617\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/260\/7ed\/c6d\/2607edc6d0eb77befe73d852f8e62848.jpg\" data-blurred=\"true\"\/><\/figure>\n<p><strong>kornia.augmentation<\/strong><\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u0443\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0432 Kornia. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u043e\u0437\u044c\u043c\u0451\u043c ColorJitter, RandomAffine, RandomPerspective.<\/p>\n<pre><code>from kornia.augmentation import AugmentationSequential  # \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u0430\u0443\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0439 \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e.  aug_list = AugmentationSequential(     K.augmentation.ColorJitter(0.1, 0.1, 0.1, 0.1, p=1.0),     K.augmentation.RandomAffine(360, [0.1, 0.1], [0.7, 1.2], [30.0, 50.0], p=1.0),     K.augmentation.RandomPerspective(0.5, p=1.0),     data_keys=[\"input\"], same_on_batch=False)  augmented_image = aug_list(image_1)<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0430\u0443\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/38c\/e02\/b00\/38ce02b0021a732e3c3434cc4bd46b5c.jpg\" width=\"925\" height=\"617\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/38c\/e02\/b00\/38ce02b0021a732e3c3434cc4bd46b5c.jpg\" data-blurred=\"true\"\/><\/figure>\n<p><strong>kornia.geometry<\/strong><\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0430\u0440\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439: \u0437\u0435\u0440\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442. <\/p>\n<pre><code># \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0435\u0440\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. fliped_image = K.geometry.transform.Vflip()(image_1)  # \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0438 \u0437\u0435\u0440\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438. concatenated_fliped_image = concat_images_h(image_1, fliped_image)<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/12b\/a6e\/69b\/12ba6e69bce8f5c248e15ccb40f5c8c8.jpg\" width=\"1850\" height=\"617\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/12b\/a6e\/69b\/12ba6e69bce8f5c248e15ccb40f5c8c8.jpg\" data-blurred=\"true\"\/><\/figure>\n<pre><code># \u041f\u043e\u0432\u0435\u0440\u043d\u0451\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 45 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432. rotated_image = K.geometry.transform.Rotate(torch.tensor([45.]))(image_1)  # \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0438 \u043f\u043e\u0432\u0451\u0440\u043d\u0443\u0442\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438. concatenated_rotated_image = concat_images_h(image_1, rotated_image)<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u043e\u0442 \u044d\u0442\u043e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/d72\/93a\/4af\/d7293a4af4349d39f2a5364b7aacd430.jpg\" width=\"1850\" height=\"617\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d72\/93a\/4af\/d7293a4af4349d39f2a5364b7aacd430.jpg\" data-blurred=\"true\"\/><\/figure>\n<h3>\u0411\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 Kornia.<\/p>\n<p><strong>Face Detection<\/strong><\/p>\n<p>\u0412 Kornia \u0432\u0441\u0442\u0440\u043e\u0435\u043d \u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440 \u043b\u0438\u0446, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u043c\u043e\u0434\u0435\u043b\u044c <a href=\"https:\/\/www.mi-research.net\/en\/article\/doi\/10.1007\/s11633-023-1423-y\" rel=\"noopener noreferrer nofollow\">YuNet<\/a>. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9fd\/2eb\/b21\/9fd2ebb21b2f50ebea4e485f8d1153a6.png\" alt=\"\u0418\u0449\u0435\u043c \u0437\u0434\u0435\u0441\u044c \u043b\u0438\u0446\u043e\" title=\"\u0418\u0449\u0435\u043c \u0437\u0434\u0435\u0441\u044c \u043b\u0438\u0446\u043e\" width=\"1677\" height=\"935\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9fd\/2eb\/b21\/9fd2ebb21b2f50ebea4e485f8d1153a6.png\"\/><\/p>\n<div><figcaption>\u0418\u0449\u0435\u043c \u0437\u0434\u0435\u0441\u044c \u043b\u0438\u0446\u043e<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u043d\u0430 \u043d\u0451\u043c \u043b\u0438\u0446\u043e. <\/p>\n<pre><code>import kornia as K import torch import cv2 from kornia.contrib import FaceDetector, FaceDetectorResult, FaceKeypoint import matplotlib.pyplot as plt import numpy as np from PIL import Image   # \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u043b\u0438\u0446\u0430 \u043d\u0430 \u0444\u043e\u0442\u043e. def draw_keypoint(img: np.ndarray, det: FaceDetectorResult, kpt_type: FaceKeypoint) -> np.ndarray:          kpt = det.get_keypoint(kpt_type).int().tolist()          return cv2.circle(img, kpt, 2, (255, 0, 0), 2)   # \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043b\u0438\u0446\u0430 \u043d\u0430 \u0444\u043e\u0442\u043e. def detect(img_raw):      if img_raw is not None:         img = K.image_to_tensor(img_raw, keepdim=False)         img = K.color.bgr_to_rgb(img.float())          # \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440 \u043b\u0438\u0446 \u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e.         face_detection = FaceDetector()         with torch.no_grad():             dets = face_detection(img)         dets = [FaceDetectorResult(o) for o in dets[0]]          img_vis = img_raw.copy()          vis_threshold = 0.95          # \u041e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0440\u0430\u043c\u043a\u0438, \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 0.95.         for b in dets:             if b.score &lt; vis_threshold:                 continue                          # \u041d\u0430\u0440\u0438\u0441\u0443\u0435\u043c bounding box \u043f\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c             img_vis = cv2.rectangle(img_vis, b.top_left.int().tolist(), b.bottom_right.int().tolist(), (255, 0, 0), 4)                          # \u041d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 \u043b\u0438\u0446\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0442\u043e\u0447\u043a\u0438             img_vis = draw_keypoint(img_vis, b, FaceKeypoint.EYE_LEFT)             img_vis = draw_keypoint(img_vis, b, FaceKeypoint.EYE_RIGHT)             img_vis = draw_keypoint(img_vis, b, FaceKeypoint.NOSE)             img_vis = draw_keypoint(img_vis, b, FaceKeypoint.MOUTH_LEFT)             img_vis = draw_keypoint(img_vis, b, FaceKeypoint.MOUTH_RIGHT)                   return img_vis  # \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. def image_show(image):     plt.imshow(image)     plt.axis('off')     plt.show()    image = np.asarray(Image.open(\"image1.png\"))  img_vis = detect(image)  image_show(img_vis)<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/264\/fe2\/788\/264fe27884e61c38cdc2db0ff7e65866.png\" alt=\"\u041b\u0438\u0446\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e\" title=\"\u041b\u0438\u0446\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e\" width=\"1677\" height=\"935\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/264\/fe2\/788\/264fe27884e61c38cdc2db0ff7e65866.png\"\/><\/p>\n<div><figcaption>\u041b\u0438\u0446\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0422\u0435\u0440\u043c\u0438\u043d\u0430\u0442\u043e\u0440 \u0441\u043c\u043e\u0433 \u0447\u0442\u043e-\u0442\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u043d\u0430 \u0444\u043e\u0442\u043e)).<\/p>\n<p><strong>Image matching<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u0434\u0432\u0443\u0445 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/community\/bibliography.html#id20\" rel=\"noopener noreferrer nofollow\">LoFTR<\/a>: Detector-Free Local Feature Matching with Transformers  \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u0432 Kornia. <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/51d\/052\/cd8\/51d052cd8a8e9bd5fe5452efdcddf752.jpg\" alt=\"\u041f\u0435\u0440\u0432\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\" title=\"\u041f\u0435\u0440\u0432\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\" width=\"334\" height=\"500\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/51d\/052\/cd8\/51d052cd8a8e9bd5fe5452efdcddf752.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u041f\u0435\u0440\u0432\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/figcaption><\/div>\n<\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/8ce\/ed2\/910\/8ceed291008704a9074000c9ee245da4.jpg\" alt=\"\u0412\u0442\u043e\u0440\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\" title=\"\u0412\u0442\u043e\u0440\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\" width=\"334\" height=\"500\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8ce\/ed2\/910\/8ceed291008704a9074000c9ee245da4.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u0412\u0442\u043e\u0440\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/figcaption><\/div>\n<\/figure>\n<pre><code># \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u043d\u0430\u0448\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f image_1 = transforms.PILToTensor()(Image.open(\"c1.jpg\")).float().unsqueeze(dim=0)\/255 image_2 = transforms.PILToTensor()(Image.open(\"c2.jpg\")).float().unsqueeze(dim=0)\/255   # \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c Detector-Free Local Feature Matching with Transformers matcher = KF.LoFTR(pretrained=\"outdoor\")  # LofTR \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0446\u0432\u0435\u0442\u043d\u044b\u043c\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0438\u0445 \u0441\u0435\u0440\u044b\u043c\u0438. input_dict = {     \"image0\": K.color.rgb_to_grayscale(image_1),       \"image1\": K.color.rgb_to_grayscale(image_2), }  # \u0414\u043b\u044f \u0442\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 # \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043b\u0430 \u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b. with torch.inference_mode():     correspondences = matcher(input_dict)   # \u041e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0442\u043e\u0447\u043a\u0438, # \u0432 \u0441\u0445\u043e\u0436\u0435\u0441\u0442\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u043d\u0430 0.8 mask = correspondences['confidence'] > 0.8 indices = torch.nonzero(mask) correspondences['confidence'] = correspondences['confidence'][indices] correspondences['keypoints0'] = correspondences['keypoints0'][indices] correspondences['keypoints1'] = correspondences['keypoints1'][indices] correspondences['batch_indexes'] = correspondences['batch_indexes'][indices]   mkpts0 = correspondences[\"keypoints0\"].cpu().numpy() mkpts1 = correspondences[\"keypoints1\"].cpu().numpy()  # \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440 findFundamentalMat() \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0441\u0435\u044f\u0442\u044c \u043d\u0435\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0442\u043e\u0447\u043a\u0438. # \u041b\u0438\u0448\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u044b \u0441\u0438\u043d\u0438\u043c \u0446\u0432\u0435\u0442\u043e\u043c. Fm, inliers = cv2.findFundamentalMat(mkpts0, mkpts1,                                      cv2.USAC_MAGSAC, 0.5, 0.999, 100000) inliers = inliers > 0   # \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u043e\u0431\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u0442\u043e\u0447\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043b\u0430 \u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438, # \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0432 \u0438\u0445 \u043b\u0438\u043d\u0438\u044f\u043c\u0438. draw_LAF_matches(     KF.laf_from_center_scale_ori(         torch.from_numpy(mkpts0).view(1, -1, 2),         torch.ones(mkpts0.shape[0]).view(1, -1, 1, 1),         torch.ones(mkpts0.shape[0]).view(1, -1, 1),     ),     KF.laf_from_center_scale_ori(         torch.from_numpy(mkpts1).view(1, -1, 2),         torch.ones(mkpts1.shape[0]).view(1, -1, 1, 1),         torch.ones(mkpts1.shape[0]).view(1, -1, 1),     ),     torch.arange(mkpts0.shape[0]).view(-1, 1).repeat(1, 2),     K.tensor_to_image(image_1),     K.tensor_to_image(image_2),     inliers,     draw_dict={\"inlier_color\": (0.2, 1, 0.2), \"tentative_color\": None,                \"feature_color\": (0.2, 0.5, 1), \"vertical\": False} ) <\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2d3\/610\/a38\/2d3610a381100cf41db8f53f0d6215c3.png\" width=\"1092\" height=\"819\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2d3\/610\/a38\/2d3610a381100cf41db8f53f0d6215c3.png\"\/><\/figure>\n<p>\u0422\u043e\u0447\u043a\u0438 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043b \u0441\u0445\u043e\u0436\u0438\u043c\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u043b\u0438\u043d\u0438\u044f\u043c\u0438. \u0421\u0438\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u043b \u043c\u0435\u0442\u043e\u0434 findFundamentalMat.<\/p>\n<p><strong>Image Stitching<\/strong><\/p>\n<p>Kornia \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0434\u043d\u043e \u043e\u0431\u0449\u0435\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>\u041d\u0430 \u0441\u0430\u0439\u0442\u0435 \u041d\u0410\u0421\u0410 \u044f \u043d\u0430\u0448\u0451\u043b \u0444\u043e\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u0435 \u043c\u0430\u0440\u0441\u043e\u0445\u043e\u0434\u043e\u043c Perseverance \u043e\u043a\u043e\u043b\u043e \u043a\u0440\u0430\u0442\u0435\u0440\u0430 \u0415\u0437\u0435\u0440\u043e (Jezero). \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0442\u0440\u0435\u043d\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043d\u0430 \u043d\u0438\u0445. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/649\/3b8\/ac6\/6493b8ac6589a8ecd8f02cc350e74fd0.jpg\" alt=\"\u041e\u043a\u0440\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u041c\u0430\u0440\u0441\u0430 \u043e\u043a\u043e\u043b\u043e \u043a\u0440\u0430\u0442\u0435\u0440\u0430 \u0415\u0437\u0435\u0440\u043e.\" title=\"\u041e\u043a\u0440\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u041c\u0430\u0440\u0441\u0430 \u043e\u043a\u043e\u043b\u043e \u043a\u0440\u0430\u0442\u0435\u0440\u0430 \u0415\u0437\u0435\u0440\u043e.\" width=\"1298\" height=\"852\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/649\/3b8\/ac6\/6493b8ac6589a8ecd8f02cc350e74fd0.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u041e\u043a\u0440\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u041c\u0430\u0440\u0441\u0430 \u043e\u043a\u043e\u043b\u043e \u043a\u0440\u0430\u0442\u0435\u0440\u0430 \u0415\u0437\u0435\u0440\u043e.<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/9a2\/7ce\/3d8\/9a27ce3d8ecf53ad2f7178fefea614b4.jpg\" alt=\"\u0418 \u0441\u043d\u043e\u0432\u0430 \u043e\u043a\u0440\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u041c\u0430\u0440\u0441\u0430.\" title=\"\u0418 \u0441\u043d\u043e\u0432\u0430 \u043e\u043a\u0440\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u041c\u0430\u0440\u0441\u0430.\" width=\"900\" height=\"852\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9a2\/7ce\/3d8\/9a27ce3d8ecf53ad2f7178fefea614b4.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u0418 \u0441\u043d\u043e\u0432\u0430 \u043e\u043a\u0440\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u041c\u0430\u0440\u0441\u0430.<\/figcaption><\/div>\n<\/figure>\n<pre><code># \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u043d\u0430\u0448\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f image_1 = transforms.PILToTensor()(Image.open(\"mars1.jpg\")).float().unsqueeze(dim=0)\/255 image_2 = transforms.PILToTensor()(Image.open(\"mars2.jpg\")).float().unsqueeze(dim=0)\/255  # \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u0431\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u043f\u0438\u0441\u043e\u043a. images = [image_1, image_2]  # \u0421\u0448\u0438\u0432\u0430\u0442\u0435\u043b\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. IS = ImageStitcher(KF.LoFTR(pretrained=\"outdoor\"), estimator=\"ransac\")  # \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0441\u0448\u0438\u0432\u0430\u0442\u0435\u043b\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043a \u0441\u043f\u0438\u0441\u043a\u0443 \u043d\u0430\u0448\u0438\u0445 \u0444\u043e\u0442\u043e. with torch.no_grad():     out = IS(*images)  # \u0412\u044b\u0432\u0435\u0434\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u0444\u043e\u0442\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d. plt.imshow(K.tensor_to_image(out)) plt.show()<\/code><\/pre>\n<p>.<\/p>\n<p>\u0412\u043e\u0442, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/955\/861\/f49\/955861f4979a3420876e0c09de47970b.jpg\" alt=\"\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439\" title=\"\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439\" width=\"1672\" height=\"852\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/955\/861\/f49\/955861f4979a3420876e0c09de47970b.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441\u043d\u0438\u043c\u043a\u0438, \u0441\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u0435 \u043c\u0430\u0440\u0441\u043e\u0445\u043e\u0434\u0430\u043c\u0438, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0442 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0430\u043d\u043e\u0440\u0430\u043c\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u041c\u0430\u0440\u0441\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0443\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435).<\/p>\n<p><strong>Visual Prompting<\/strong> <\/p>\n<p>Visual Prompting \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043e\u043a &#8212; \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u0438\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u0440\u0430\u043c\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0438\u0441\u043a\u043e\u043c\u044b\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440. \u0418 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u044d\u0442\u0438\u043c \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u0442\u043e\u0447\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0445\u043e\u0436\u0438 \u043d\u0430 \u0442\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0442\u043e\u0447\u043a\u0438, \u0447\u0442\u043e \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043e\u0431\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440  <a href=\"https:\/\/dl.fbaipublicfiles.com\/segment_anything\/sam_vit_h_4b8939.pth\" rel=\"noopener noreferrer nofollow\">ViT-H SAM<\/a>. \u0414\u0430\u043b\u044c\u0448\u0435 \u0431\u0443\u0434\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0435\u0433\u043e \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u0438 \u0432\u044b\u0432\u043e\u0434\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d.<\/p>\n<pre><code>import kornia as K import torch import cv2 import matplotlib.pyplot as plt from kornia.contrib.visual_prompter import VisualPrompter from kornia.geometry.keypoints import Keypoints from kornia.geometry.boxes import Boxes from kornia.contrib.models import SegmentationResults from kornia.utils import tensor_to_image   # \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0434\u0435\u0432\u0430\u0439\u0441: \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0440\u0442\u0443 \u0438\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440. if torch.cuda.is_available():    print(\"Training on GPU\")    device = torch.device(\"cuda:0\") else:      print(\"Training on CPU\")      device = torch.device(\"cpu\")   # \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. def load_torch_image(file_name):     image = K.image_to_tensor(cv2.imread(file_name), False).float() \/ 255     image = K.color.bgr_to_rgb(image)     return image   # \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d. def show_image(tensor):     image = K.utils.tensor_to_image(tensor)     plt.imshow(image)     plt.axis('off')     plt.show()   # \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u043d\u0430\u0448\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f image_1 = load_torch_image(\"image_sea.jpg\")  # \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. show_image(image_1)<\/code><\/pre>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c VisualPrompter. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 ViT-H SAM, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0435\u0441\u0438\u0442 \u043f\u043e\u0447\u0442\u0438 2,5 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442\u0430. \u041d\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c ViT-L SAM \u043e\u043d \u0432\u0435\u0441\u0438\u0442 \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u043c\u0435\u043d\u044c\u0448\u0435, \u043b\u0438\u0431\u043e ViT-B SAM -\u043e\u043d \u0432\u0435\u0441\u0438\u0442 348 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442. \u041f\u043e\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0432 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430\u0448\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<pre><code>prompter = VisualPrompter() prompter.set_image(torch.squeeze(image_1))<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 &#8212; \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u0438. \u041f\u0435\u0440\u0432\u044b\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0442\u043e\u0447\u043a\u0438 \u044d\u0442\u043e \u0442\u043e\u0447\u043a\u0438 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u0432\u043e\u0434\u0435, \u0438 \u043d\u0430 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u044b \u0437\u0435\u043b\u0451\u043d\u044b\u043c\u0438 \u043a\u0440\u0435\u0441\u0442\u0438\u043a\u0430\u043c\u0438. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0442\u043e\u0447\u043a\u0438 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u043d\u0435\u0431\u0443, \u043e\u0431\u043b\u0430\u043a\u0430\u043c, \u0441\u043e\u043b\u043d\u0446\u0443 \u0438 \u043d\u0430 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u044b \u043a\u0440\u0430\u0441\u043d\u044b\u043c\u0438 \u043a\u0440\u0435\u0441\u0442\u0438\u043a\u0430\u043c\u0438. \u0414\u0430\u043b\u044c\u0448\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043c\u0435\u0442\u043a\u0438 0 \u0438 1. \u0417\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0442\u043e\u0447\u043a\u0438 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u0432\u043e\u0434\u0435, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0443\u043b\u0451\u043c.<\/p>\n<pre><code>keypoints = Keypoints(torch.tensor([[[100.0, 100.0], [225.0, 475.0], [485.0, 450.0], [547.0, 384.0],                                      [10.0, 600.0], [100.0, 590.0], [200.0, 580.0], [485.0, 566.0]]],                                     device=device, dtype=torch.float32))  labels = torch.zeros(keypoints.shape[:2], device=device, dtype=torch.float32)  labels_to_query = labels.clone() labels_to_query[..., 4:] = 1<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c, \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0435\u0439 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u0438 \u043c\u0435\u0442\u043a\u0438. <\/p>\n<pre><code>prediction = prompter.predict(    keypoints=keypoints,    keypoints_labels=labels_to_query,    multimask_output=False, output_original_size=True)<\/code><\/pre>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u0438\u0434\u0443\u0442 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u043a\u0438, \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u0438 \u0432\u044b\u0432\u043e\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d.<\/p>\n<pre><code>def colorize_masks(binary_masks: torch.Tensor, merge: bool = True, alpha: None | float = None) -> list[torch.Tensor]:     \"\"\"Convert binary masks (B, C, H, W), boolean tensors, into masks with colors (B, (3, 4) , H, W) - RGB or RGBA. Where C refers to the number of masks.     Args:         binary_masks: a batched boolean tensor (B, C, H, W)         merge: If true, will join the batch dimension into a unique mask.         alpha: alpha channel value. If None, will generate RGB images      Returns:         A list of `C` colored masks.     \"\"\"     B, C, H, W = binary_masks.shape     OUT_C = 4 if alpha else 3      output_masks = []      for idx in range(C):         _out = torch.zeros(B, OUT_C, H, W, device=binary_masks.device, dtype=torch.float32)         for b in range(B):             color = torch.rand(1, 3, 1, 1, device=binary_masks.device, dtype=torch.float32)             if alpha:                 color = torch.cat([color, torch.tensor([[[[alpha]]]], device=binary_masks.device, dtype=torch.float32)], dim=1)              to_colorize = binary_masks[b, idx, ...].view(1, 1, H, W).repeat(1, OUT_C, 1, 1)             _out[b, ...] = torch.where(to_colorize, color, _out[b, ...])         output_masks.append(_out)      if merge:         output_masks = [c.max(dim=0)[0] for c in output_masks]      return output_masks   def show_binary_masks(binary_masks: torch.Tensor, axes) -> None:     \"\"\"plot binary masks, with shape (B, C, H, W), where C refers to the number of masks.      will merge the `B` channel into a unique mask.     Args:         binary_masks: a batched boolean tensor (B, C, H, W)         ax: a list of matplotlib axes with lenght of C     \"\"\"     colored_masks = colorize_masks(binary_masks, True, 1.0)      for ax, mask in zip(axes, colored_masks):         ax.imshow(tensor_to_image(mask))   def show_boxes(boxes: Boxes, ax) -> None:     boxes_tensor = boxes.to_tensor(mode=\"xywh\").detach().cpu().numpy()     for batched_boxes in boxes_tensor:         for box in batched_boxes:             x0, y0, w, h = box             ax.add_patch(plt.Rectangle((x0, y0), w, h, edgecolor=\"orange\", facecolor=(0, 0, 0, 0), lw=2))   def show_points(points: tuple[Keypoints, torch.Tensor], ax, marker_size=200):     coords, labels = points     pos_points = coords[labels == 1].to_tensor().detach().cpu().numpy()     neg_points = coords[labels == 0].to_tensor().detach().cpu().numpy()      ax.scatter(pos_points[:, 0], pos_points[:, 1], color=\"green\", marker=\"+\", s=marker_size, linewidth=2)     ax.scatter(neg_points[:, 0], neg_points[:, 1], color=\"red\", marker=\"x\", s=marker_size, linewidth=2)    def show_predictions(     image: torch.Tensor,     predictions: SegmentationResults,     points: tuple[Keypoints, torch.Tensor] | None = None,     boxes: Boxes | None = None, ) -> None:     n_masks = predictions.logits.shape[1]      fig, axes = plt.subplots(1, n_masks, figsize=(21, 16))     axes = [axes] if n_masks == 1 else axes      for idx, ax in enumerate(axes):         score = predictions.scores[:, idx, ...].mean()         ax.imshow(tensor_to_image(image))         ax.set_title(f\"Mask {idx+1}, Score: {score:.3f}\", fontsize=18)          if points:             show_points(points, ax)          if boxes:             show_boxes(boxes, ax)          ax.axis(\"off\")      show_binary_masks(predictions.binary_masks, axes)     plt.show()<\/code><\/pre>\n<p>\u041a\u043e\u0434 \u0432\u044b\u0432\u043e\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d.<\/p>\n<pre><code>show_predictions(image_1, prediction, points=(keypoints, labels_to_query))<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0441\u043a\u043e\u0439. \u041f\u043e \u0447\u0435\u0442\u044b\u0440\u0451\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0442\u043e\u0447\u043a\u0430\u043c, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u043c\u0441\u044f \u043a \u0432\u043e\u0434\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0430 \u0432\u0441\u044e \u0432\u043e\u0434\u0443 \u043d\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430 \u0444\u043e\u0442\u043e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0442\u043e\u0447\u043a\u0430\u043c\u0438 (\u0437\u0435\u043b\u0451\u043d\u044b\u0435 \u0438 \u043a\u0440\u0430\u0441\u043d\u044b\u0435 \u043a\u0440\u0435\u0441\u0442\u0438\u043a\u0438).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/214\/74a\/a94\/21474aa9499fe4665e8b0c2a09cf6e41.png\" width=\"1647\" height=\"1132\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/214\/74a\/a94\/21474aa9499fe4665e8b0c2a09cf6e41.png\"\/><\/figure>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043e\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u044d\u0442\u043e\u0439 <a href=\"https:\/\/kornia.github.io\/tutorials\/nbs\/image_prompter.html\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0435\u0441\u044c \u043f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 Kornia. \u0418\u0445 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435. \u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0438 Kornia <a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/applications\/intro.html\" rel=\"noopener noreferrer nofollow\">\u043e\u0431\u0435\u0449\u0430\u043b\u0438 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c<\/a> \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439: Super Resolution, Deep Edge detection, Stereo and Optical flow and camera calibration, Neural Rendering. \u0427\u0442\u043e \u0436\u0435, \u0436\u0434\u0451\u043c. \u0410 \u043f\u043e\u043a\u0430, \u0441\u043a\u0430\u0436\u0435\u043c \u0438\u043c \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0442\u043e, \u0447\u0442\u043e \u0443\u0436\u0435 \u0435\u0441\u0442\u044c.<\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e Kornia \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u0441\u044b\u043b\u043a\u0430\u043c.<\/p>\n<p>\u0421\u0441\u044b\u043b\u043a\u0438:<\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/github.com\/kornia\/kornia\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 Kornia<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/get-started\/introduction.html#\" rel=\"noopener noreferrer nofollow\">\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e Kornia<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.github.io\/tutorials\/\" rel=\"noopener noreferrer nofollow\">\u0422\u0443\u0442\u043e\u0440\u0438\u0430\u043b<\/a><\/p>\n<\/li>\n<\/ol>\n<p>\u041a\u043e\u0434 \u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u0437 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430\u0445 \u043f\u043e <a href=\"https:\/\/github.com\/The-Illusive-Man-2000\/Kornia_Examples\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>.<\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438! \u0415\u0441\u043b\u0438 \u0432\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 Kornia, \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u0441\u0432\u043e\u0438\u043c\u0438 \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0438\u043b\u0438 \u043e\u043f\u044b\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445. <\/p>\n<\/p>\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\/articles\/765176\/\"> https:\/\/habr.com\/ru\/articles\/765176\/<\/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<p>\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0414\u043c\u0438\u0442\u0440\u0438\u0439. \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f \u044f\u0432\u043b\u044f\u044e\u0441\u044c \u043c\u0430\u0433\u0438\u0441\u0442\u0440\u0430\u043d\u0442\u043e\u043c \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043a\u0443\u0440\u0441\u0430 \u0432 \u0418\u0422\u041c\u041e. \u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u044b\u043c \u0437\u0440\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u0447\u0430\u043b \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0442\u044b\u0440\u0435 \u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u043e Kornia.  <\/p>\n<p>Kornia \u044d\u0442\u043e open source \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f. \u041e\u043d\u0430   \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 PyTorch \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0431\u044d\u043a\u0435\u043d\u0434\u0430 \u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440 \u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439. \u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u044f\u043b\u0438\u0441\u044c OpenCV, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 Kornia \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u043c, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u0445 \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u0438\u0442. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c Kornia \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0442\u0435\u043c \u0436\u0435 OpenCV, scikit-image \u0438\u043b\u0438 \u0441 Albumentations \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u0430\u0442\u0447\u0430\u043c\u0438, \u0430 \u043d\u0435 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 GPU. \u041e\u0431 \u044d\u0442\u043e\u043c \u0434\u0430\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Albumentations \u0432 \u0441\u0432\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0432\u043e\u0442 <a href=\"https:\/\/habr.com\/ru\/articles\/680514\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a> \u043d\u0430 \u043d\u0435\u0451. \u0422\u0430\u043a\u0436\u0435 \u0438\u0437 \u043b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u043e\u0433\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0438\u0437 Sber AI \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430  \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 faceswap \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043a\u0430\u0434\u0440\u043e\u0432 \u0431\u0430\u0442\u0447\u0430\u043c\u0438 \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0430 \u0447\u0430\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043d\u0430 Kornia, \u0432\u043e\u0442 <a href=\"https:\/\/habr.com\/ru\/companies\/sberbank\/articles\/645919\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a> \u043d\u0430 \u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044e.  <\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e Kornia \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u044b\u043c \u0437\u0440\u0435\u043d\u0438\u0435\u043c:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/opencv.org\/\" rel=\"noopener noreferrer nofollow\">OpenCV<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/scikit-image.org\/\" rel=\"noopener noreferrer nofollow\">Scikit-Image<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/pytorch.org\/vision\/stable\/index.html\" rel=\"noopener noreferrer nofollow\">Torchvision<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/image\" rel=\"noopener noreferrer nofollow\">Tensorflow.image<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/albumentations.ai\/\" rel=\"noopener noreferrer nofollow\">Albumentations<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0438 Kornia \u0432 \u0441\u0432\u043e\u0435\u0439 <a href=\"https:\/\/arxiv.org\/pdf\/1910.02190.pdf\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u043f\u043e \u0432\u0441\u0435\u043c \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043f\u0443\u043d\u043a\u0442\u0430\u043c \u0441 Kornia \u043c\u043e\u0436\u0435\u0442 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e Tensorflow.image.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0438 Kornia \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0438 <a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/augmentation.html\" rel=\"noopener noreferrer nofollow\">\u0437\u0430\u043c\u0435\u0440\u044b<\/a> \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0430\u0443\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0437\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a.<\/p>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"center\"><strong>Libraries<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"center\"><strong>TorchVision<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"center\"><strong>Albumentations<\/strong><\/p>\n<\/td>\n<td colspan=\"3\" data-colwidth=\"50,50,0\" width=\"50\">\n<p align=\"center\"><strong>Kornia (GPU)<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"center\"><strong>Batch Size<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"center\">1<\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"center\">1<\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"center\">1<\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"center\">32<\/p>\n<\/td>\n<td>\n<p align=\"center\">128<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomPerspective<\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.88\u00b11.82<\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.68\u00b13.60  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.74\u00b12.84  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.37\u00b12.67  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.20\u00b127.00<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">ColorJiggle  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.40\u00b12.88  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">3.58\u00b13.66  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.14\u00b13.85  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.90\u00b124.68  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.83\u00b112.96  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomAffine  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">3.12\u00b15.80  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">2.43\u00b17.11  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">3.01\u00b17.80  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.30\u00b14.39  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.18\u00b16.30<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomVerticalFlip  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.32\u00b10.08  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.34\u00b10.16  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.35\u00b10.82  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.02\u00b10.13  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.01\u00b10.35  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomHorizontalFlip  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.32\u00b10.08  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.34\u00b10.18  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.31\u00b10.59  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.01\u00b10.26  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.01\u00b10.37  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomRotate  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">1.82\u00b14.70  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">1.59\u00b14.33  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">1.58\u00b14.44  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.25\u00b12.09  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.17\u00b15.69  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomCrop  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.09\u00b13.41  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.03\u00b14.94  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">3.84\u00b13.07  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.16\u00b11.17<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.08\u00b19.42  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomErasing  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">2.31\u00b11.47  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">1.89\u00b11.08  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">2.32\u00b13.31  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.44\u00b12.82  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.57\u00b19.74  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomGrayscale  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.41\u00b10.18  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.43\u00b10.60  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.45\u00b11.20<\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.03\u00b10.11  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.03\u00b17.10  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">RandomResizedCrop  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.23\u00b12.86  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">3.80\u00b13.61  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4.07\u00b12.67  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.23\u00b15.27  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.13\u00b18.04  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">CenterCrop  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">2.93\u00b11.29  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">2.81\u00b11.38  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">2.88\u00b12.34  <\/p>\n<\/td>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">0.13\u00b12.20  <\/p>\n<\/td>\n<td>\n<p align=\"left\">0.07\u00b19.41  <\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e Kornia \u0434\u0435\u043b\u0430\u0435\u0442 \u0430\u0443\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u0430\u0442\u0447\u0430\u043c\u0438. \u0415\u0441\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435, \u0442\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043f\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043d\u0435\u0442.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0432\u0445\u043e\u0434\u044f\u0442 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 Kornia.<\/p>\n<p><strong>\u041c\u043e\u0434\u0443\u043b\u0438 Kornia:<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/augmentation.html\" rel=\"noopener noreferrer nofollow\">kornia.augmentation<\/a> &#8212; \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0430\u0443\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/color.html\" rel=\"noopener noreferrer nofollow\">kornia.color<\/a> &#8212; \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 (rgb to grayscale, rgb to bgr \u0438 \u0442.\u0434.).<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/contrib.html\" rel=\"noopener noreferrer nofollow\">kornia.contrib<\/a> &#8212; \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438. \u0415\u0441\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u0438 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0434\u0435\u0442\u0435\u043a\u0446\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0435\u0441\u0442\u044c MobileViT, TinyViT.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/enhance.html\" rel=\"noopener noreferrer nofollow\">kornia.enhance<\/a> &#8212; \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044f\u0440\u043a\u043e\u0441\u0442\u0438, \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0440\u0435\u0437\u043a\u043e\u0441\u0442\u0438 \u0438 \u0442.\u0434. \u0415\u0441\u0442\u044c \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 CLAHE.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/feature.html\" rel=\"noopener noreferrer nofollow\">kornia.feature<\/a> &#8212; \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u043a\u0446\u0438\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0443\u0433\u043b\u043e\u0432, \u043b\u0438\u043d\u0438\u0439 \u0438 \u0442.\u0434. \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/filters.html#\" rel=\"noopener noreferrer nofollow\">kornia.filters <\/a>&#8212; \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u043c\u044b\u0442\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u043d\u0438\u0446 (Canny, Sobel \u0438 \u0442.\u0434.). <\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/geometry.html\" rel=\"noopener noreferrer nofollow\">kornia.geometry<\/a> &#8212; \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439: \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435, \u0441\u0434\u0432\u0438\u0433, \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438 \u0442.\u0434.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/sensors.html\" rel=\"noopener noreferrer nofollow\">kornia.sensors<\/a> &#8212; \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u0438\u0434\u0435\u043e \u043a\u0430\u043c\u0435\u0440\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/io.html\" rel=\"noopener noreferrer nofollow\">kornia.io<\/a> &#8212; \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 kornia_rs, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Rust. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 Linux.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/image.html\" rel=\"noopener noreferrer nofollow\">kornia.image<\/a> &#8212; \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u043c\u043e\u0434\u0443\u043b\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0430\u043d\u0430\u043b\u043e\u0432, \u0444\u043e\u0440\u043c\u0430\u0442 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0438\u0437 \u0444\u0430\u0439\u043b\u0430, \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0432 torch tensor \u0438\u0437 numpy array \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0438 \u0442.\u0434. <\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/losses.html\" rel=\"noopener noreferrer nofollow\">kornia.losses<\/a> &#8212; \u043c\u043e\u0434\u0443\u043b\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/metrics.html\" rel=\"noopener noreferrer nofollow\">kornia.metrics<\/a> &#8212; \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043c\u0435\u0442\u0440\u0438\u043a (accuracy, mean_iou \u0438 \u0442.\u0434.).<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/morphology.html\" rel=\"noopener noreferrer nofollow\">kornia.morphology<\/a> &#8212; \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u043c\u043e\u0440\u0444\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439:\u00a0\u0441\u0443\u0436\u0435\u043d\u0438\u0435 (erosion),\u00a0\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 (dilation),\u00a0\u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 (opening),\u00a0\u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 (closing) \u0438 \u0442.\u0434..<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/tracking.html\" rel=\"noopener noreferrer nofollow\">kornia.tracking<\/a>  \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u0434\u0440\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/testing.html\" rel=\"noopener noreferrer nofollow\">kornia.testing<\/a> &#8212; \u043c\u043e\u0434\u0443\u043b\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0441\u0435\u0439\u0447\u0430\u0441 \u0438\u0445 \u0442\u0430\u043c \u0432\u0441\u0435\u0433\u043e \u0442\u0440\u0438).<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/utils.html\" rel=\"noopener noreferrer nofollow\">kornia.utils<\/a> &#8212; \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u043b\u0438\u043d\u0438\u0439, \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432, \u0432\u044b\u043f\u0443\u043a\u043b\u044b\u0445 \u043c\u043d\u043e\u0433\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043e\u0431\u043b\u0430\u043a\u043e\u0432 \u0442\u043e\u0447\u0435\u043a \u0438 \u0442.\u0434. <\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/kornia.readthedocs.io\/en\/latest\/x.html\" rel=\"noopener noreferrer nofollow\">kornia.x<\/a> &#8212; \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435  API \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0432 Kornia. \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438 \u0434\u0435\u0442\u0435\u043a\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. <\/p>\n<\/li>\n<\/ul>\n<p>Kornia \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043e\u0431\u0448\u0438\u0440\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0435\u0451 \u043c\u043e\u0434\u0443\u043b\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0438 \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e. \u0420\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431\u043e \u0432\u0441\u0451\u043c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043b\u0438\u0448\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 Kornia.<\/p>\n<p><strong>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/strong><\/p>\n<p>\u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c :<\/p>\n<pre><code>pip install kornia<\/code><\/pre>\n<p>\u041b\u0438\u0431\u043e, \u0435\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0433\u0438\u0442\u0445\u0430\u0431\u0430:<\/p>\n<pre><code>pip install git+https:\/\/github.com\/kornia\/kornia<\/code><\/pre>\n<p> \u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c kornia.io \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438\/\u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c kornia_rs, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Rust. \u041d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 kornia_rs \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 Linux.<\/p>\n<pre><code>pip install kornia_rs<\/code><\/pre>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0435\u0441\u043b\u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 Training API, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0435\u0449\u0451 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c kornia[x].<\/p>\n<pre><code>pip install kornia[x]<\/code><\/pre>\n<h3>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Kornia<\/h3>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Kornia, \u0430 \u043f\u043e\u0442\u043e\u043c \u0443\u0436\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c. \u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0418\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/figcaption><\/div>\n<\/figure>\n<p><strong>kornia.color<\/strong><\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0446\u0432\u0435\u0442\u043e\u0432\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u0441\u0435\u0440\u044b\u043c.<\/p>\n<pre><code># \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 def load_torch_image(file_name):     image = K.image_to_tensor(cv2.imread(file_name), False).float() \/ 255     image = K.color.bgr_to_rgb(image)     return image   # \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0441\u043e\u0432\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0432 \u043e\u0434\u043d\u043e (\u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438). def concat_images_h(image1, image2):     image1 = transforms.ToPILImage()(torch.squeeze(image1))     image2 = transforms.ToPILImage()(torch.squeeze(image2))     concatenated_images = Image.new('RGB', (image1.width + image2.width, image1.height))     concatenated_images.paste(image1, (0, 0))     concatenated_images.paste(image2, (image1.width, 0))     return concatenated_images   # \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. image_1 = load_torch_image(\"image_sea.jpg\")  # \u041f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0435\u0440\u044b\u0439 \u0446\u0432\u0435\u0442. image_gray = K.color.rgb_to_grayscale(image_1)  # \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438 \u0435\u0433\u043e \u0441\u0435\u0440\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432 \u043e\u0434\u043d\u0443 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443. concatenated_images_contrast = concat_images_h(image_1, image_gray)<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e \u0444\u0438\u043b\u044c\u0442\u0440 Sepia.<\/p>\n<pre><code>image_sepia = K.color.Sepia(rescale=False)(image_1)  concatenated_image_sepia = concat_images_h(image_1, image_sepia)<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p><strong>kornia.enhance<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442. <\/p>\n<pre><code># \u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442. image_contrast = K.enhance.adjust_contrast(image_1, 1.5)  concatenated_images_contrast = concat_images_h(image_1, image_contrast)<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0438\u043b\u044c\u0442\u0440\u0430 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Adaptive_histogram_equalization\" rel=\"noopener noreferrer nofollow\">CLAHE<\/a>.<\/p>\n<pre><code># \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440 CLAHE \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e. image_clahe = K.enhance.equalize_clahe(image_1)  concatenated_images_clahe = concat_images_h(image_1, image_clahe)  save_tensor_as_image('concatenated_images_clahe.jpg', concatenated_images_clahe)<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p><strong>kornia.filters<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0439\u0434\u0435\u043c \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Canny_edge_detector\" rel=\"noopener noreferrer nofollow\">Canny<\/a>.<\/p>\n<pre><code># \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c Canny \u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e. image_canny = K.filters.canny(image_1)[0]  concatenated_images_canny = concat_images_h(image_1, image_canny)<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A0%D0%B0%D0%B7%D0%BC%D1%8B%D1%82%D0%B8%D0%B5_%D0%BF%D0%BE_%D0%93%D0%B0%D1%83%D1%81%D1%81%D1%83\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u0437\u043c\u044b\u0442\u0438\u0435 \u0413\u0430\u0443\u0441\u0441\u0430<\/a>.<\/p>\n<pre><code># \u0424\u0438\u043b\u044c\u0442\u0440 \u0413\u0430\u0443\u0441\u0441\u0430. gaussian_blur = K.filters.GaussianBlur2d((5, 5), (4.5, 4.5))  # \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440 \u0413\u0430\u0443\u0441\u0441\u0430 \u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e. image_gaussian_blur = gaussian_blur(image_1)  concatenated_images_gaussian_blur = concat_images_h(image_1, image_gaussian_blur)<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u044b\u0442\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p><strong>kornia.losses<\/strong><\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0447\u0443 \u0437\u0430\u043e\u0441\u0442\u0440\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 Kornia \u0435\u0441\u0442\u044c \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u0430\u0440\u044b \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043e\u0448\u0438\u0431\u043e\u043a. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043e \u0448\u0435\u0441\u0442\u044c \u043b\u043e\u0441\u0441-\u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u042f \u0438\u0445 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044e.<\/p>\n<ul>\n<li>\n<p>binary_focal_loss_with_logits<\/p>\n<\/li>\n<li>\n<p>focal_loss<\/p>\n<\/li>\n<li>\n<p>dice_loss<\/p>\n<\/li>\n<li>\n<p>tversky_loss  <\/p>\n<\/li>\n<li>\n<p>lovasz_hinge_loss<\/p>\n<\/li>\n<li>\n<p>lovasz_softmax_loss<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0448\u0438\u0431\u043a\u0438 \u0441\u0430\u043c\u043e\u043c\u0443, \u043d\u043e \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u043e\u043d\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442, \u0437\u0430\u0447\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434?<\/p>\n<p><strong>kornia.utils<\/strong><\/p>\n<p>Kornia \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445 \u043b\u0438\u043d\u0438\u0438 \u0438 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438. \u041d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a.<\/p>\n<pre><code>image_with_rectangle = K.utils.draw_rectangle(image_1, torch.tensor([[[10, 10, 400, 400]]]),                                               color=torch.tensor([1,0, 255]), fill=None)<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u043b\u0438\u043d\u0438\u044e.<\/p>\n<pre><code>image_with_line = K.utils.draw_line(torch.squeeze(image_1),                                     torch.tensor([10, 10]),                                     torch.tensor([500, 250]),                                     torch.tensor([1,0,255]))<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<p><strong>kornia.morphology<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e \u043c\u043e\u0440\u0444\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438: \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442, \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435, \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435. \u0415\u0441\u0442\u044c \u0434\u0432\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043c\u043e\u0440\u0444\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438: \u044d\u0440\u043e\u0437\u0438\u044f \u0438 \u0434\u0438\u043b\u0430\u0442\u0430\u0446\u0438\u044f. \u0413\u0440\u0430\u0434\u0438\u0435\u043d\u0442, \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u0445 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u043c\u0438 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f\u043c\u0438.<\/p>\n<pre><code>kernel = torch.tensor([[0, 1, 0], [1, 1, 1], [0, 1, 0]])  # \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430 \u044d\u0442\u043e \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u044d\u0440\u043e\u0437\u0438\u0438 \u0438 \u0434\u0438\u043b\u0430\u0442\u0430\u0446\u0438\u0438. graded_image = K.morphology.gradient(image_1, kernel)<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<pre><code># \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u044d\u0440\u043e\u0437\u0438\u0438, \u0430 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0451 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u0438\u043b\u0430\u0442\u0430\u0446\u0438\u0438. opened_image = K.morphology.opening(image_1, kernel)<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<pre><code># \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u0438\u043b\u0430\u0442\u0430\u0446\u0438\u0438, \u0430 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0451 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u044d\u0440\u043e\u0437\u0438\u0438. closed_image = K.morphology.closing(image_1, kernel)<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<p><strong>kornia.augmentation<\/strong><\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u0443\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0432 Kornia. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u043e\u0437\u044c\u043c\u0451\u043c ColorJitter, RandomAffine, RandomPerspective.<\/p>\n<pre><code>from kornia.augmentation import AugmentationSequential  # \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u0430\u0443\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0439 \u0438<\/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-356574","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/356574","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=356574"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/356574\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=356574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=356574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=356574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}