{"id":322782,"date":"2021-05-08T15:00:46","date_gmt":"2021-05-08T15:00:46","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=322782"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=322782","title":{"rendered":"\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e YOLOv3 \u043d\u0430 Tensorflow 2.0"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/34b\/004\/091\/34b004091d149fede15c54a27b50efe1.jpg\" alt=\"\u041a\u0430\u0434\u0440 \u0438\u0437 \u0430\u043d\u0438\u043c\u0435 &quot;\u0416\u0440\u0438\u0446\u0430 \u0438 \u043c\u0435\u0434\u0432\u0435\u0434\u044c&quot;\" title=\"\u041a\u0430\u0434\u0440 \u0438\u0437 \u0430\u043d\u0438\u043c\u0435 &quot;\u0416\u0440\u0438\u0446\u0430 \u0438 \u043c\u0435\u0434\u0432\u0435\u0434\u044c&quot;\" width=\"1280\" height=\"625\"><figcaption>\u041a\u0430\u0434\u0440 \u0438\u0437 \u0430\u043d\u0438\u043c\u0435 &#171;\u0416\u0440\u0438\u0446\u0430 \u0438 \u043c\u0435\u0434\u0432\u0435\u0434\u044c&#187;<\/figcaption><\/figure>\n<p>\u0414\u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f YOLO \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u043a\u0446\u0438\u0438. \u0412 YOLO \u0436\u0435, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0431\u044b\u043b\u043e \u0441\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043a\u0430\u043a \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u0440\u0430\u043c\u043e\u043a (<em>bounding boxes<\/em>) \u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043d\u0438\u043c\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c \u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0435 <a href=\"http:\/\/datahacker.rs\/object-detection-yolo-algorithm\/\" rel=\"noopener noreferrer nofollow\">YOLO Object Detection<\/a> \u0438 \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0432 Tensorflow 2.0  <\/p>\n<blockquote>\n<p><em>\u041e YOLO:<\/em><\/p>\n<p><em>\u041d\u0430\u0448\u0430 \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0447\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0430. \u0411\u0430\u0437\u043e\u0432\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c YOLO \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e 45 \u043a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u0423\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0441\u0435\u0442\u0438, Fast YOLO, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0430\u0436 155 \u043a\u0430\u0434\u0440\u0430 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443\u2026<\/em><\/p>\n<p><em>\u2014 You Only Look Once: Unified, Real-Time Object Detection, 2015<\/em><\/p>\n<\/blockquote>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 YOLO?<\/h3>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7ba\/221\/f96\/7ba221f96ea6dd5e92960537e4c6ad40.jpg\" width=\"1024\" height=\"331\"><figcaption><\/figcaption><\/figure>\n<p>YOLO \u2013 \u044d\u0442\u043e \u043d\u043e\u0432\u0435\u0439\u0448\u0430\u044f (\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438) \u0441\u0438\u0441\u0442\u0435\u043c\u0430 (\u0441\u0435\u0442\u044c) \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041e\u043d\u0430 \u0431\u044b\u043b\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u0430 \u0414\u0436\u043e\u0437\u0435\u0444\u043e\u043c \u0420\u0435\u0434\u043c\u043e\u043d\u043e\u043c (Joseph Redmon). \u041d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c YOLO \u043d\u0430\u0434 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c. \u041c\u043e\u0434\u0435\u043b\u0438 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 YOLO \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u044b \u0438 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u044f\u0442 R-CNN (<em>Region-Based Convolutional Neural Network<\/em>) \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.  <\/p>\n<p>\u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 (\u0432 2016 \u0433\u043e\u0434\u0443) \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a R-CNN \u0438 DPM (<em>Deformable Part Model<\/em>), YOLO \u0434\u043e\u0431\u0438\u043b\u0430\u0441\u044c \u043f\u0435\u0440\u0435\u0434\u043e\u0432\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f mAP (<em>mean Average Precision<\/em>). \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, YOLO \u0438\u0441\u043f\u044b\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u0441 \u0442\u043e\u0447\u043d\u043e\u0439 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u044b\u043b\u0438 \u0432\u043d\u0435\u0441\u0435\u043d\u044b \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0432 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.  <\/p>\n<p><strong>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b <\/strong>(\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u0442\u044c\u0438): \u0414\u0440\u0443\u0433\u0438\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0433\u043e \u043e\u043a\u043d\u0430 \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e, \u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (<em>DPM<\/em>). \u0422\u0430\u043a\u0436\u0435, R-CNN \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0440\u0435\u0433\u0438\u043e\u043d\u043e\u0432 (<em>region proposal method<\/em>). \u041e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 <a href=\"http:\/\/datahacker.rs\/deep-learning-bounding-boxes\/\" rel=\"noopener noreferrer nofollow\">bounding box\u2019\u044b<\/a>. \u0417\u0430\u0442\u0435\u043c, \u043d\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0435 bounding box\u2019\u0430\u043c\u0438, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0439, \u0438 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0435 \u0433\u0440\u0430\u043d\u0438\u0446 \u0440\u0430\u043c\u043e\u043a.  <\/p>\n<p>YOLO \u043f\u0435\u0440\u0435\u043e\u0441\u043c\u044b\u0441\u043b\u0438\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0443 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0437\u0430\u0434\u0430\u0447\u0443 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438.&nbsp;\u041e\u043d\u0430 \u0438\u0434\u0435\u0442 \u043e\u0442 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c bounding box\u2019\u043e\u0432 \u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c, \u0435\u0434\u0438\u043d\u0430\u044f \u0441\u0432\u0435\u0440\u0442\u043e\u0447\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e bounding box\u2019\u043e\u0432 \u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0434\u043b\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439.  <\/p>\n<h3>\u0422\u0435\u043e\u0440\u0438\u044f<\/h3>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a YOLO \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0433\u043e \u043e\u043a\u043d\u0430 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0435\u043b\u0435\u043d\u043e \u043d\u0430 \u0441\u0435\u0442\u043a\u0443 \u0441 \u044f\u0447\u0435\u0439\u043a\u0430\u043c\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c<strong> <\/strong><code>S x S<\/code>. \u041a\u0430\u0436\u0434\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f.  <\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043a\u0430\u0436\u0434\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 bounding box\u2019\u043e\u0432. \u0422\u0430\u043a\u0436\u0435, \u043a\u0430\u0436\u0434\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u0435\u0442 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (<em>confidence value<\/em>) \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0439 bounding box\u2019\u043e\u043c. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e \u0438\u043b\u0438 \u0438\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438. \u0422\u043e \u0435\u0441\u0442\u044c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u044f\u0447\u0435\u0439\u043a\u0430 \u0441\u0435\u0442\u043a\u0438 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0431\u044b\u043b\u043e \u043d\u0438\u0437\u043a\u0438\u043c. <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u0430\u0440\u0442\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u043e \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e, \u0440\u0430\u043c\u043a\u0438. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/86a\/921\/b57\/86a921b57addead615404875aade49de.png\" width=\"1338\" height=\"712\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043a\u0430\u0436\u0434\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u042d\u0442\u043e \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u044f\u0447\u0435\u0439\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442, \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0435\u0441\u043b\u0438 \u044f\u0447\u0435\u0439\u043a\u0430 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044c, \u044d\u0442\u043e \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044c \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u043d\u0435\u0439. \u042d\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043b\u0438\u0448\u044c&nbsp; \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442, \u0442\u043e \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044c.  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439 \u043e\u043f\u0438\u0448\u0435\u043c \u0432\u044b\u0432\u043e\u0434 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>\u0412 YOLO \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f <a href=\"https:\/\/towardsdatascience.com\/anchor-boxes-the-key-to-quality-object-detection-ddf9d612d4f9\" rel=\"noopener noreferrer nofollow\">anchor boxes<\/a> (<em>\u044f\u043a\u043e\u0440\u043d\u044b\u0435 \u0440\u0430\u043c\u043a\u0438 \/ \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u043c\u043a\u0438<\/em>) \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f bounding box\u2019\u043e\u0432. \u0418\u0434\u0435\u044f anchor box\u2019\u043e\u0432 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u043e\u0440\u043c. \u0418 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0434\u0432\u0430 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0441 \u0434\u0432\u0443\u043c\u044f anchor box\u2019\u0430\u043c\u0438 (\u0432 \u0446\u0435\u043b\u043e\u043c, \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u0436\u0435 \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e anchor box\u2019\u043e\u0432). \u042d\u0442\u0438 \u044f\u043a\u043e\u0440\u044f \u0431\u044b\u043b\u0438 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 <a href=\"https:\/\/cocodataset.org\/#home\" rel=\"noopener noreferrer nofollow\">COCO<\/a> (<em>Common Objects in Context<\/em>) \u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u041c\u0435\u0442\u043e\u0434_k-\u0441\u0440\u0435\u0434\u043d\u0438\u0445\" rel=\"noopener noreferrer nofollow\">k-\u0441\u0440\u0435\u0434\u043d\u0438\u0445<\/a> (<em>K-means clustering<\/em>).  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/65f\/858\/685\/65f858685d4cca7ee66455842c2d9c25.png\" width=\"1338\" height=\"802\"><figcaption><\/figcaption><\/figure>\n<p>\u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u0435\u0442\u043a\u0430, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442: <\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e bounding box&#8217;\u0430:  <\/p>\n<ul>\n<li>\n<p>4 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b (t<sub>x <\/sub>, t<sub>y <\/sub>, t<sub>w <\/sub>, t<sub>h<\/sub>) <\/p>\n<\/li>\n<li>\n<p>1 objectness error (<em>\u043e\u0448\u0438\u0431\u043a\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438<\/em>), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0442\u043e\u0433\u043e \u0438\u043b\u0438 \u0438\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430  <\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u043b\u0435\u0432\u043e\u0433\u043e \u0443\u0433\u043b\u0430 \u043d\u0430 c<sub>x <\/sub>, c<sub>y<\/sub>&nbsp; \u0442\u043e \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u044b \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c: <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"b_{x} = \\sigma(t_{x}) + c_{x}\\\\ b_{y} = \\sigma(t_{y}) + c_{y}\\\\ b_{w} = p_{w}e^{t_{w}}\\\\ b_{h} = p_{h}e^{t_{h}}\" alt=\"b_{x} = \\sigma(t_{x}) + c_{x}\\\\ b_{y} = \\sigma(t_{y}) + c_{y}\\\\ b_{w} = p_{w}e^{t_{w}}\\\\ b_{h} = p_{h}e^{t_{h}}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3b6\/72f\/499\/3b672f4996669ea1e3e7286029ead6e7.svg\" width=\"733\" height=\"92\"><\/p>\n<p>\u0433\u0434\u0435 p<sub>w<\/sub> (<em>\u0448\u0438\u0440\u0438\u043d\u0430<\/em>) \u0438 p<sub>h <\/sub>(<em>\u0432\u044b\u0441\u043e\u0442\u0430<\/em>) \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0448\u0438\u0440\u0438\u043d\u0435 \u0438 \u0432\u044b\u0441\u043e\u0442\u0435 bounding box&#8217;\u0430.&nbsp; \u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u0443\u0433\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 YOLOv2, \u0430\u0432\u0442\u043e\u0440\u044b \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u044e\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u044f\u0447\u0435\u0439\u043a\u0438.  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u0432\u044b\u0432\u043e\u0434 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u043d\u0430\u0448\u0435\u0439 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u0412 \u043e\u0431\u0449\u0435\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0437\u0434\u0435\u0441\u044c<code>S x S x [B * (4+1+C)]<\/code> \u0432\u044b\u0432\u043e\u0434\u043e\u0432, \u0433\u0434\u0435 <code>B<\/code> \u2013 \u044d\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e bounding box&#8217;\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u044f\u0447\u0435\u0439\u043a\u0430 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, <code>C<\/code> \u2013 \u044d\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0430\u0441\u0441\u043e\u0432, <code>4<\/code> \u2013 \u0434\u043b\u044f bounding box&#8217;\u043e\u0432, <code>1<\/code> \u2013 \u0434\u043b\u044f objectness prediction (<em>\u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438<\/em>). \u0417\u0430 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0445\u043e\u0434 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0439\u0442\u0438 \u043e\u0442 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u0442\u0435\u043d\u0437\u043e\u0440\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435. \u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e YOLOv3 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u0435\u0442 bounding box&#8217;\u044b \u0432 \u0442\u0440\u0435\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430\u0445.   <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u043c\u044b \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438 \u0443\u043c\u043d\u043e\u0436\u0438\u043c \u0438\u0445 \u043d\u0430 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432\u0441\u0435 bounding box&#8217;\u044b, \u0432\u0437\u0432\u0435\u0448\u0435\u043d\u043d\u044b\u0435 \u043f\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430.  <\/p>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437\u0431\u0430\u0432\u0438\u0442 \u043d\u0430\u0441 \u043e\u0442 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u043e\u0432 \u0441 \u043d\u0438\u0437\u043a\u0438\u043c \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c. \u0414\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0448\u0430\u0433\u0430 \u0432\u0430\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0443 <a href=\"http:\/\/datahacker.rs\/deep-learning-intersection-over-union\/\" rel=\"noopener noreferrer nofollow\">IoU<\/a> (<em>Intersection over Union \/ \u041f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u0434 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c<\/em>). \u042d\u0442\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0440\u0430\u0432\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043f\u043b\u043e\u0449\u0430\u0434\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u043a \u043f\u043b\u043e\u0449\u0430\u0434\u0438 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445.  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a21\/a1a\/da8\/a21a1ada85de33d03f125572e2c080da.png\" width=\"795\" height=\"305\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043c\u043e\u0433\u0443\u0442 \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b, \u0438 \u0447\u0442\u043e\u0431\u044b \u043e\u0442 \u043d\u0438\u0445 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"http:\/\/datahacker.rs\/deep-learning-intersection-over-union\/\" rel=\"noopener noreferrer nofollow\">\u201c\u043f\u043e\u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0435-\u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u0432\u201d<\/a> (<em>non-maximum suppression<\/em>). \u041f\u043e\u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0435-\u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u0432 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c: \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u0435\u0440\u0451\u0442 bounding box \u0441 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u0438 \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0443, \u0437\u0430\u0442\u0435\u043c, \u0441\u0440\u0435\u0434\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0433\u0440\u0430\u043d\u0438\u0447\u0430\u0449\u0438\u0445 bounding box&#8217;\u043e\u0432 \u0441 \u0434\u0430\u043d\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u0432\u043e\u0437\u044c\u043c\u0451\u0442 \u043e\u0434\u0438\u043d \u0441 \u043d\u0430\u0438\u0432\u044b\u0441\u0448\u0438\u043c IoU \u0438 \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e. <\/p>\n<p>\u0412\u0432\u0438\u0434\u0443 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u0441\u0435 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0433\u043e\u043d, \u044d\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u043e\u0447\u0442\u0438 \u0442\u0430\u043a\u0436\u0435 \u0431\u044b\u0441\u0442\u0440\u043e, \u043a\u0430\u043a \u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0432\u0441\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435\u044f\u0432\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442. \u041f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0442\u044c\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u0435, \u0438\u0445 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.  <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ca4\/26c\/7c4\/ca426c7c458355ee0712f143b36fae69.jpg\" alt=\"Yolov3\" title=\"Yolov3\" width=\"481\" height=\"567\"><figcaption>Yolov3<\/figcaption><\/figure>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e YOLO: <\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/arxiv.org\/pdf\/1506.02640.pdf\" rel=\"noopener noreferrer nofollow\">You Only Look Once: Unified, Real-Time Object Detection<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/arxiv.org\/pdf\/1612.08242.pdf\" rel=\"noopener noreferrer nofollow\">YOLO9000: Better, Faster, Stronger<\/a>  <\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/pjreddie.com\/media\/files\/papers\/YOLOv3.pdf\" rel=\"noopener noreferrer nofollow\">YOLOv3: An Incremental Improvement<\/a>  <\/p>\n<\/li>\n<\/ul>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432 Tensorflow<\/h3>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 YOLO \u044d\u0442\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430 \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u0426\u0435\u043b\u0438\u043a\u043e\u043c \u043d\u043e\u0443\u0442\u0431\u0443\u043a \u0441 \u043a\u043e\u0434\u043e\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430 <a href=\"https:\/\/github.com\/gingermuffin\/YOLOv3-Tensorflow\" rel=\"noopener noreferrer nofollow\">Github<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/www.kaggle.com\/anastasiakim\/yolov3-tensorflow\" rel=\"noopener noreferrer nofollow\">Kaggle<\/a>:  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u043e\u043b\u043d\u0443\u044e \u0441\u0432\u0435\u0440\u0442\u043e\u0447\u043d\u0443\u044e \u0441\u0435\u0442\u044c (<em>fully convolutional network \/ FCN<\/em>) \u0431\u0435\u0437 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u0443 \u0441\u0435\u0442\u044c \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0432\u0435\u0441\u0430 \u043e\u0442 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u042d\u0442\u0438 \u0432\u0435\u0441\u0430 \u0431\u044b\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u043e\u0442 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f YOLOv3 \u043d\u0430 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 <a href=\"https:\/\/cocodataset.org\/#home\" rel=\"noopener noreferrer nofollow\">COCO<\/a> (<em>Common Objects in Context<\/em>). \u0424\u0430\u0439\u043b \u0441 \u0432\u0435\u0441\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"https:\/\/pjreddie.com\/media\/files\/yolov3.weights\" rel=\"noopener noreferrer nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430<\/a>.  <\/p>\n<pre><code class=\"python\"># \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u0434\u043b\u044f checkpoint'\u043e\u0432 \u0441 \u0432\u0435\u0441\u0430\u043c\u0438. # !mkdir checkpoints  # \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0441 \u0432\u0435\u0441\u0430\u043c\u0438 \u0434\u043b\u044f YOLOv3 \u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430. # !wget https:\/\/pjreddie.com\/media\/files\/yolov3.weights  # \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. import cv2 import numpy as np  import tensorflow as tf   from absl import logging from itertools import repeat from PIL import Image  from tensorflow.keras import Model from tensorflow.keras.layers import Add, Concatenate, Lambda from tensorflow.keras.layers import Conv2D, Input, LeakyReLU from tensorflow.keras.layers import MaxPool2D, UpSampling2D, ZeroPadding2D from tensorflow.keras.regularizers import l2 from tensorflow.keras.losses import binary_crossentropy from tensorflow.keras.losses import sparse_categorical_crossentropy  yolo_iou_threshold = 0.6 # Intersection Over Union (iou) threshold. yolo_score_threshold = 0.6 # Score threshold.  weightyolov3 = 'yolov3.weights' # \u041f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u0441 \u0432\u0435\u0441\u0430\u043c\u0438. size = 416 # \u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.  checkpoints = 'checkpoints\/yolov3.tf' # \u041f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u0441 checkpoint'\u043e\u043c. num_classes = 80 # \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432 \u043c\u043e\u0434\u0435\u043b\u0438.  # \u0421\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0435\u0432 \u0432 YOLOv3 Fully Convolutional Network (FCN). YOLO_V3_LAYERS = [     'yolo_darknet',     'yolo_conv_0',     'yolo_output_0',     'yolo_conv_1',     'yolo_output_1',     'yolo_conv_2',     'yolo_output_2' ]<\/code><\/pre>\n<p>\u041f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u043b\u043e\u0435\u0432 \u0432 <a href=\"https:\/\/pjreddie.com\/darknet\/yolo\/\" rel=\"noopener noreferrer nofollow\">Darknet <\/a>(<em>open source NN framework<\/em>) \u0438 tf.keras \u0440\u0430\u0437\u043d\u044b\u0435, \u0442\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432\u0435\u0441\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0447\u0438\u0441\u0442\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e API \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0432 keras. TF Checkpoints \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043d\u044b \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u0434\u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438 \u043e\u043d\u0438 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f Tensorflow.  <\/p>\n<pre><code class=\"python\"># \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432\u0435\u0441\u043e\u0432 \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. def load_darknet_weights(model, weights_file):     wf = open(weights_file, 'rb')     major, minor, revision, seen, _ = np.fromfile(wf, dtype=np.int32, count=5)     layers = YOLO_V3_LAYERS      for layer_name in layers:         sub_model = model.get_layer(layer_name)         for i, layer in enumerate(sub_model.layers):             if not layer.name.startswith('conv2d'):                 continue             batch_norm = None             if i + 1 &lt; len(sub_model.layers) and \\                 sub_model.layers[i + 1].name.startswith('batch_norm'):                     batch_norm = sub_model.layers[i + 1]              logging.info(\"{}\/{} {}\".format(                 sub_model.name, layer.name, 'bn' if batch_norm else 'bias'))                          filters = layer.filters             size = layer.kernel_size[0]             in_dim = layer.input_shape[-1]              if batch_norm is None:                 conv_bias = np.fromfile(wf, dtype=np.float32, count=filters)             else:                 bn_weights = np.fromfile(wf, dtype=np.float32, count=4*filters)                 bn_weights = bn_weights.reshape((4, filters))[[1, 0, 2, 3]]              conv_shape = (filters, in_dim, size, size)             conv_weights = np.fromfile(wf, dtype=np.float32, count=np.product(conv_shape))             conv_weights = conv_weights.reshape(conv_shape).transpose([2, 3, 1, 0])              if batch_norm is None:                 layer.set_weights([conv_weights, conv_bias])             else:                 layer.set_weights([conv_weights])                 batch_norm.set_weights(bn_weights)      assert len(wf.read()) == 0, 'failed to read weights'     wf.close()<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0436\u0435 \u044d\u0442\u0430\u043f\u0435, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 IoU. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <a href=\"https:\/\/habr.com\/ru\/post\/309302\/\" rel=\"noopener noreferrer nofollow\">batch normalization<\/a> (<em>\u043f\u0430\u043a\u0435\u0442\u043d\u0430\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/em>) \u0434\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435. \u0422\u0430\u043a \u043a\u0430\u043a tf.keras.layers.BatchNormalization \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043b\u044f <a href=\"https:\/\/habr.com\/ru\/company\/binarydistrict\/blog\/428255\/\" rel=\"noopener noreferrer nofollow\">\u0442\u0440\u0430\u043d\u0441\u0444\u0435\u0440\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f<\/a> (<em>transfer learning<\/em>), \u0442\u043e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434.  <\/p>\n<pre><code class=\"python\"># \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 IoU. def interval_overlap(interval_1, interval_2):     x1, x2 = interval_1     x3, x4 = interval_2     if x3 &lt; x1:         return 0 if x4 &lt; x1 else (min(x2,x4) - x1)     else:         return 0 if x2 &lt; x3 else (min(x2,x4) - x3)  def intersectionOverUnion(box1, box2):     intersect_w = interval_overlap([box1.xmin, box1.xmax], [box2.xmin, box2.xmax])     intersect_h = interval_overlap([box1.ymin, box1.ymax], [box2.ymin, box2.ymax])     intersect_area = intersect_w * intersect_h      w1, h1 = box1.xmax-box1.xmin, box1.ymax-box1.ymin     w2, h2 = box2.xmax-box2.xmin, box2.ymax-box2.ymin      union_area = w1*h1 + w2*h2 - intersect_area     return float(intersect_area) \/ union_area   class BatchNormalization(tf.keras.layers.BatchNormalization):     def call(self, x, training=False):         if training is None: training = tf.constant(False)         training = tf.logical_and(training, self.trainable)         return super().call(x, training)  # \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c 3 anchor box'\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438.    yolo_anchors = np.array([(10, 13), (16, 30), (33, 23), (30, 61), (62, 45),                         (59, 119), (116, 90), (156, 198), (373, 326)], np.float32) \/ 416 yolo_anchor_masks = np.array([[6, 7, 8], [3, 4, 5], [0, 1, 2]])<\/code><\/pre>\n<p>\u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c 3 anchor box&#8217;\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u043c\u0430\u0441\u043a\u0430 \u0431\u0443\u0434\u0435\u0442:<\/p>\n<ul>\n<li>\n<p>0, 1, 2 \u2013 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u043f\u0435\u0440\u0432\u044b\u0435 \u0442\u0440\u0438 \u044f\u043a\u043e\u0440\u043d\u044b\u0435 \u0440\u0430\u043c\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>3, 4 ,5 \u2013 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0430\u044f, \u043f\u044f\u0442\u0430\u044f \u0438 \u0448\u0435\u0441\u0442\u0430\u044f<\/p>\n<\/li>\n<li>\n<p>6, 7, 8 \u2013 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0441\u0435\u0434\u044c\u043c\u0430\u044f, \u0432\u043e\u0441\u044c\u043c\u0430\u044f, \u0434\u0435\u0432\u044f\u0442\u0430\u044f<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\"># \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 bounding box'\u043e\u0432. def draw_outputs(img, outputs, class_names, white_list=None):     boxes, score, classes, nums = outputs     boxes, score, classes, nums = boxes[0], score[0], classes[0], nums[0]     wh = np.flip(img.shape[0:2])     for i in range(nums):         if class_names[int(classes[i])] not in white_list:             continue         x1y1 = tuple((np.array(boxes[i][0:2]) * wh).astype(np.int32))         x2y2 = tuple((np.array(boxes[i][2:4]) * wh).astype(np.int32))         img = cv2.rectangle(img, x1y1, x2y2, (255, 0, 0), 2)         img = cv2.putText(img, '{} {:.4f}'.format(             class_names[int(classes[i])], score[i]),             x1y1, cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 2)     return img<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 YOLOv3. \u0418\u0434\u0435\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u0435\u0440\u0442\u043e\u0447\u043d\u044b\u0435 \u0441\u043b\u043e\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u0438\u0445 \u0437\u0434\u0435\u0441\u044c 53, \u0442\u043e \u0441\u0430\u043c\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0430\u0436\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u043e\u0442 \u0441\u043b\u043e\u044f \u043a \u0441\u043b\u043e\u044e.  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/abd\/ec5\/756\/abdec5756f59f5dc3fba632612132089.jpg\" width=\"1536\" height=\"635\"><figcaption><\/figcaption><\/figure>\n<p><a href=\"http:\/\/datahacker.rs\/deep-learning-residual-networks\/\" rel=\"noopener noreferrer nofollow\">\u041e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438<\/a> (<em>Residual Blocks<\/em>) \u0432 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b YOLOv3 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432. \u041e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u0439 \u0431\u043b\u043e\u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u0435\u0440\u0442\u043e\u0447\u043d\u044b\u0445 \u0441\u043b\u043e\u0435\u0432 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0432\u044f\u0437\u0438 \u0434\u043b\u044f \u043e\u0431\u0445\u043e\u0434\u0430 \u044d\u0442\u0438\u0445 \u0441\u043b\u043e\u0435\u0432.  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/20c\/bfc\/6ad\/20cbfc6ad315a31d2276bf55e59655a5.png\" width=\"1130\" height=\"635\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c, \u043c\u044b \u0441\u0442\u0440\u043e\u0438\u043c \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e API, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u0421 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0431\u0435\u0437 \u0442\u0440\u0443\u0434\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0435\u0442\u0432\u0438 \u0432 \u043d\u0430\u0448\u0435\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 (<em>ResNet Block<\/em>) \u0438 \u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043b\u043e\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b.  <\/p>\n<pre><code class=\"python\">def DarknetConv(x, filters, size, strides=1, batch_norm=True):     if strides == 1:         padding = 'same'     else:         x = ZeroPadding2D(((1, 0), (1, 0)))(x)         padding = 'valid'     x = Conv2D(filters=filters, kernel_size=size,               strides=strides, padding=padding,               use_bias=not batch_norm, kernel_regularizer=l2(0.0005))(x)     if batch_norm:         x = BatchNormalization()(x)         x = LeakyReLU(alpha=0.1)(x)     return x  def DarknetResidual(x, filters):     previous = x     x = DarknetConv(x, filters \/\/ 2, 1)     x = DarknetConv(x, filters, 3)     x = Add()([previous , x])     return x  def DarknetBlock(x, filters, blocks):     x = DarknetConv(x, filters, 3, strides=2)     for _ in repeat(None, blocks):         x = DarknetResidual(x, filters)            return x  def Darknet(name=None):     x = inputs = Input([None, None, 3])     x = DarknetConv(x, 32, 3)     x = DarknetBlock(x, 64, 1)     x = DarknetBlock(x, 128, 2)     x = x_36 = DarknetBlock(x, 256, 8)     x = x_61 = DarknetBlock(x, 512, 8)     x = DarknetBlock(x, 1024, 4)     return tf.keras.Model(inputs, (x_36, x_61, x), name=name)    def YoloConv(filters, name=None):     def yolo_conv(x_in):         if isinstance(x_in, tuple):             inputs = Input(x_in[0].shape[1:]), Input(x_in[1].shape[1:])             x, x_skip = inputs              x = DarknetConv(x, filters, 1)             x = UpSampling2D(2)(x)             x = Concatenate()([x, x_skip])         else:             x = inputs = Input(x_in.shape[1:])          x = DarknetConv(x, filters, 1)         x = DarknetConv(x, filters * 2, 3)         x = DarknetConv(x, filters, 1)         x = DarknetConv(x, filters * 2, 3)         x = DarknetConv(x, filters, 1)         return Model(inputs, x, name=name)(x_in)     return yolo_conv    def YoloOutput(filters, anchors, classes, name=None):     def yolo_output(x_in):         x = inputs = Input(x_in.shape[1:])         x = DarknetConv(x, filters * 2, 3)         x = DarknetConv(x, anchors * (classes + 5), 1, batch_norm=False)         x = Lambda(lambda x: tf.reshape(x, (-1, tf.shape(x)[1], tf.shape(x)[2],                                         anchors, classes + 5)))(x)         return tf.keras.Model(inputs, x, name=name)(x_in)     return yolo_output  def yolo_boxes(pred, anchors, classes):     grid_size = tf.shape(pred)[1]     box_xy, box_wh, score, class_probs = tf.split(pred, (2, 2, 1, classes), axis=-1)      box_xy = tf.sigmoid(box_xy)     score = tf.sigmoid(score)     class_probs = tf.sigmoid(class_probs)     pred_box = tf.concat((box_xy, box_wh), axis=-1)      grid = tf.meshgrid(tf.range(grid_size), tf.range(grid_size))     grid = tf.expand_dims(tf.stack(grid, axis=-1), axis=2)      box_xy = (box_xy + tf.cast(grid, tf.float32)) \/  tf.cast(grid_size, tf.float32)     box_wh = tf.exp(box_wh) * anchors      box_x1y1 = box_xy - box_wh \/ 2     box_x2y2 = box_xy + box_wh \/ 2     bbox = tf.concat([box_x1y1, box_x2y2], axis=-1)          return bbox, score, class_probs, pred_box<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0435-\u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u0432. <\/p>\n<pre><code class=\"python\">def nonMaximumSuppression(outputs, anchors, masks, classes):     boxes, conf, out_type = [], [], []      for output in outputs:         boxes.append(tf.reshape(output[0], (tf.shape(output[0])[0], -1, tf.shape(output[0])[-1])))         conf.append(tf.reshape(output[1], (tf.shape(output[1])[0], -1, tf.shape(output[1])[-1])))         out_type.append(tf.reshape(output[2], (tf.shape(output[2])[0], -1, tf.shape(output[2])[-1])))      bbox = tf.concat(boxes, axis=1)     confidence = tf.concat(conf, axis=1)     class_probs = tf.concat(out_type, axis=1)      scores = confidence * class_probs        boxes, scores, classes, valid_detections = tf.image.combined_non_max_suppression(         boxes=tf.reshape(bbox, (tf.shape(bbox)[0], -1, 1, 4)),         scores=tf.reshape(             scores, (tf.shape(scores)[0], -1, tf.shape(scores)[-1])),         max_output_size_per_class=100,         max_total_size=100,         iou_threshold=yolo_iou_threshold,         score_threshold=yolo_score_threshold)        return boxes, scores, classes, valid_detections<\/code><\/pre>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f:<\/p>\n<pre><code class=\"python\">def YoloV3(size=None, channels=3, anchors=yolo_anchors,             masks=yolo_anchor_masks, classes=80, training=False):     x = inputs = Input([size, size, channels])      x_36, x_61, x = Darknet(name='yolo_darknet')(x)      x = YoloConv(512, name='yolo_conv_0')(x)     output_0 = YoloOutput(512, len(masks[0]), classes, name='yolo_output_0')(x)      x = YoloConv(256, name='yolo_conv_1')((x, x_61))     output_1 = YoloOutput(256, len(masks[1]), classes, name='yolo_output_1')(x)      x = YoloConv(128, name='yolo_conv_2')((x, x_36))     output_2 = YoloOutput(128, len(masks[2]), classes, name='yolo_output_2')(x)      if training:         return Model(inputs, (output_0, output_1, output_2), name='yolov3')      boxes_0 = Lambda(lambda x: yolo_boxes(x, anchors[masks[0]], classes),                   name='yolo_boxes_0')(output_0)     boxes_1 = Lambda(lambda x: yolo_boxes(x, anchors[masks[1]], classes),                   name='yolo_boxes_1')(output_1)     boxes_2 = Lambda(lambda x: yolo_boxes(x, anchors[masks[2]], classes),                   name='yolo_boxes_2')(output_2)      outputs = Lambda(lambda x: nonMaximumSuppression(x, anchors, masks, classes),                   name='nonMaximumSuppression')((boxes_0[:3], boxes_1[:3], boxes_2[:3]))      return Model(inputs, outputs, name='yolov3')<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0442\u0435\u0440\u044c:<\/p>\n<pre><code class=\"python\">def YoloLoss(anchors, classes=80, ignore_thresh=0.5):     def yolo_loss(y_true, y_pred):         pred_box, pred_obj, pred_class, pred_xywh = yolo_boxes(             y_pred, anchors, classes)         pred_xy = pred_xywh[..., 0:2]         pred_wh = pred_xywh[..., 2:4]          true_box, true_obj, true_class_idx = tf.split(             y_true, (4, 1, 1), axis=-1)         true_xy = (true_box[..., 0:2] + true_box[..., 2:4]) \/ 2         true_wh = true_box[..., 2:4] - true_box[..., 0:2]          box_loss_scale = 2 - true_wh[..., 0] * true_wh[..., 1]          grid_size = tf.shape(y_true)[1]         grid = tf.meshgrid(tf.range(grid_size), tf.range(grid_size))         grid = tf.expand_dims(tf.stack(grid, axis=-1), axis=2)         true_xy = true_xy * tf.cast(grid_size, tf.float32) - \\             tf.cast(grid, tf.float32)         true_wh = tf.math.log(true_wh \/ anchors)         true_wh = tf.where(tf.math.is_inf(true_wh),                       tf.zeros_like(true_wh), true_wh)          obj_mask = tf.squeeze(true_obj, -1)          true_box_flat = tf.boolean_mask(true_box, tf.cast(obj_mask, tf.bool))         best_iou = tf.reduce_max(intersectionOverUnion(             pred_box, true_box_flat), axis=-1)         ignore_mask = tf.cast(best_iou &lt; ignore_thresh, tf.float32)          xy_loss = obj_mask * box_loss_scale * \\             tf.reduce_sum(tf.square(true_xy - pred_xy), axis=-1)         wh_loss = obj_mask * box_loss_scale * \\             tf.reduce_sum(tf.square(true_wh - pred_wh), axis=-1)         obj_loss = binary_crossentropy(true_obj, pred_obj)         obj_loss = obj_mask * obj_loss + \\             (1 - obj_mask) * ignore_mask * obj_loss          class_loss = obj_mask * sparse_categorical_crossentropy(             true_class_idx, pred_class)          xy_loss = tf.reduce_sum(xy_loss, axis=(1, 2, 3))         wh_loss = tf.reduce_sum(wh_loss, axis=(1, 2, 3))         obj_loss = tf.reduce_sum(obj_loss, axis=(1, 2, 3))         class_loss = tf.reduce_sum(class_loss, axis=(1, 2, 3))          return xy_loss + wh_loss + obj_loss + class_loss     return yolo_loss<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f &#171;\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0446\u0435\u043b\u0438&#187; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u0440\u0442\u0435\u0436 \u0438\u0437 \u0444\u043e\u0440\u043c:<\/p>\n<pre><code class=\"python\">(     [N, 13, 13, 3, 6],     [N, 26, 26, 3, 6],     [N, 52, 52, 3, 6] )<\/code><\/pre>\n<p>\u0413\u0434\u0435 <code>N<\/code> \u2013 \u0447\u0438\u0441\u043b\u043e \u043c\u0435\u0442\u043e\u043a \u0432 \u043f\u0430\u043a\u0435\u0442\u0435, \u0430 \u0447\u0438\u0441\u043b\u043e <code>6<\/code><strong> <\/strong>\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 <code>[x, y, w, h, obj, class]<\/code> bounding box&#8217;\u0430.<\/p>\n<pre><code class=\"python\">@tf.function def transform_targets_for_output(y_true, grid_size, anchor_idxs, classes):      N = tf.shape(y_true)[0]      y_true_out = tf.zeros(       (N, grid_size, grid_size, tf.shape(anchor_idxs)[0], 6))      anchor_idxs = tf.cast(anchor_idxs, tf.int32)      indexes = tf.TensorArray(tf.int32, 1, dynamic_size=True)     updates = tf.TensorArray(tf.float32, 1, dynamic_size=True)     idx = 0     for i in tf.range(N):         for j in tf.range(tf.shape(y_true)[1]):             if tf.equal(y_true[i][j][2], 0):                 continue             anchor_eq = tf.equal(                 anchor_idxs, tf.cast(y_true[i][j][5], tf.int32))              if tf.reduce_any(anchor_eq):                 box = y_true[i][j][0:4]                 box_xy = (y_true[i][j][0:2] + y_true[i][j][2:4]) \/ 2                  anchor_idx = tf.cast(tf.where(anchor_eq), tf.int32)                 grid_xy = tf.cast(box_xy \/\/ (1\/grid_size), tf.int32)                  indexes = indexes.write(                     idx, [i, grid_xy[1], grid_xy[0], anchor_idx[0][0]])                 updates = updates.write(                     idx, [box[0], box[1], box[2], box[3], 1, y_true[i][j][4]])                 idx += 1      return tf.tensor_scatter_nd_update(         y_true_out, indexes.stack(), updates.stack())   def transform_targets(y_train, anchors, anchor_masks, classes):     outputs = []     grid_size = 13      anchors = tf.cast(anchors, tf.float32)     anchor_area = anchors[..., 0] * anchors[..., 1]     box_wh = y_train[..., 2:4] - y_train[..., 0:2]     box_wh = tf.tile(tf.expand_dims(box_wh, -2),                     (1, 1, tf.shape(anchors)[0], 1))     box_area = box_wh[..., 0] * box_wh[..., 1]     intersection = tf.minimum(box_wh[..., 0], anchors[..., 0]) * \\     tf.minimum(box_wh[..., 1], anchors[..., 1])     iou = intersection \/ (box_area + anchor_area - intersection)     anchor_idx = tf.cast(tf.argmax(iou, axis=-1), tf.float32)     anchor_idx = tf.expand_dims(anchor_idx, axis=-1)      y_train = tf.concat([y_train, anchor_idx], axis=-1)      for anchor_idxs in anchor_masks:         outputs.append(transform_targets_for_output(             y_train, grid_size, anchor_idxs, classes))         grid_size *= 2      return tuple(outputs) # [x, y, w, h, obj, class]   def preprocess_image(x_train, size):     return (tf.image.resize(x_train, (size, size))) \/ 255<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c, \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432\u0435\u0441\u0430 \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0412 COCO \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 \u0438\u0445<strong> <\/strong>80.<\/p>\n<pre><code class=\"python\">yolo = YoloV3(classes=num_classes)  load_darknet_weights(yolo, weightyolov3)  yolo.save_weights(checkpoints)  class_names =  [\"person\", \"bicycle\", \"car\", \"motorbike\", \"aeroplane\", \"bus\", \"train\", \"truck\",     \"boat\", \"traffic light\", \"fire hydrant\", \"stop sign\", \"parking meter\", \"bench\",     \"bird\", \"cat\", \"dog\", \"horse\", \"sheep\", \"cow\", \"elephant\", \"bear\", \"zebra\", \"giraffe\",     \"backpack\", \"umbrella\", \"handbag\", \"tie\", \"suitcase\", \"frisbee\", \"skis\", \"snowboard\",     \"sports ball\", \"kite\", \"baseball bat\", \"baseball glove\", \"skateboard\", \"surfboard\",     \"tennis racket\", \"bottle\", \"wine glass\", \"cup\", \"fork\", \"knife\", \"spoon\", \"bowl\",     \"banana\",\"apple\", \"sandwich\", \"orange\", \"broccoli\", \"carrot\", \"hot dog\", \"pizza\", \"donut\",     \"cake\",\"chair\", \"sofa\", \"pottedplant\", \"bed\", \"diningtable\", \"toilet\", \"tvmonitor\", \"laptop\",      \"mouse\",\"remote\", \"keyboard\", \"cell phone\", \"microwave\", \"oven\", \"toaster\", \"sink\",     \"refrigerator\",\"book\", \"clock\", \"vase\", \"scissors\", \"teddy bear\", \"hair drier\", \"toothbrush\"]  def detect_objects(img_path, white_list=None):     image = img_path     # \u041f\u0443\u0442\u044c \u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e.     img = tf.image.decode_image(open(image, 'rb').read(), channels=3)      img = tf.expand_dims(img, 0)     img = preprocess_image(img, size)     boxes, scores, classes, nums = yolo(img)      img = cv2.imread(image)     img = draw_outputs(img, (boxes, scores, classes, nums), class_names, white_list)      cv2.imwrite('detected_{:}'.format(img_path), img)      detected = Image.open('detected_{:}'.format(img_path))     detected.show()      detect_objects('test.jpg', ['bear'])<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/172\/2e6\/d21\/1722e6d21f7b3a2bd7210d8f0464cc3f.jpg\" width=\"640\" height=\"351\"><figcaption><\/figcaption><\/figure>\n<h3>\u0418\u0442\u043e\u0433<\/h3>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043e\u0431 \u043e\u0442\u043b\u0438\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u0445 YOLOv3 \u0438 \u0435\u0451 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430\u0445 \u043f\u0435\u0440\u0435\u0434 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438. \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c TensorFlow 2.0 (TF \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 2.0).<\/p>\n<h3>\u0421\u0441\u044b\u043b\u043a\u0438<\/h3>\n<ul>\n<li>\n<p><a href=\"https:\/\/github.com\/zzh8829\/yolov3-tf2\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u043b\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f YOLOv3 \u043d\u0430 Tensorflow 2.0<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/gingermuffin\/YOLOv3-Tensorflow\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f YOLOv3 \u0438\u0437 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/pjreddie.com\/media\/files\/papers\/YOLOv3.pdf\" rel=\"noopener noreferrer nofollow\">YOLOv3 &#8212; Joseph Redmon<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/556404\/\"> https:\/\/habr.com\/ru\/post\/556404\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><figcaption>\u041a\u0430\u0434\u0440 \u0438\u0437 \u0430\u043d\u0438\u043c\u0435 &#171;\u0416\u0440\u0438\u0446\u0430 \u0438 \u043c\u0435\u0434\u0432\u0435\u0434\u044c&#187;<\/figcaption><\/figure>\n<p>\u0414\u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f YOLO \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u043a\u0446\u0438\u0438. \u0412 YOLO \u0436\u0435, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0431\u044b\u043b\u043e \u0441\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043a\u0430\u043a \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u0440\u0430\u043c\u043e\u043a (<em>bounding boxes<\/em>) \u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043d\u0438\u043c\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c \u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0435 <a href=\"http:\/\/datahacker.rs\/object-detection-yolo-algorithm\/\" rel=\"noopener noreferrer nofollow\">YOLO Object Detection<\/a> \u0438 \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0432 Tensorflow 2.0  <\/p>\n<blockquote>\n<p><em>\u041e YOLO:<\/em><\/p>\n<p><em>\u041d\u0430\u0448\u0430 \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0447\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0430. \u0411\u0430\u0437\u043e\u0432\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c YOLO \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e 45 \u043a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u0423\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0441\u0435\u0442\u0438, Fast YOLO, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0430\u0436 155 \u043a\u0430\u0434\u0440\u0430 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443\u2026<\/em><\/p>\n<p><em>\u2014 You Only Look Once: Unified, Real-Time Object Detection, 2015<\/em><\/p>\n<\/blockquote>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 YOLO?<\/h3>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>YOLO \u2013 \u044d\u0442\u043e \u043d\u043e\u0432\u0435\u0439\u0448\u0430\u044f (\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438) \u0441\u0438\u0441\u0442\u0435\u043c\u0430 (\u0441\u0435\u0442\u044c) \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041e\u043d\u0430 \u0431\u044b\u043b\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u0430 \u0414\u0436\u043e\u0437\u0435\u0444\u043e\u043c \u0420\u0435\u0434\u043c\u043e\u043d\u043e\u043c (Joseph Redmon). \u041d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c YOLO \u043d\u0430\u0434 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c. \u041c\u043e\u0434\u0435\u043b\u0438 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 YOLO \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u044b \u0438 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u044f\u0442 R-CNN (<em>Region-Based Convolutional Neural Network<\/em>) \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.  <\/p>\n<p>\u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 (\u0432 2016 \u0433\u043e\u0434\u0443) \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a R-CNN \u0438 DPM (<em>Deformable Part Model<\/em>), YOLO \u0434\u043e\u0431\u0438\u043b\u0430\u0441\u044c \u043f\u0435\u0440\u0435\u0434\u043e\u0432\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f mAP (<em>mean Average Precision<\/em>). \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, YOLO \u0438\u0441\u043f\u044b\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u0441 \u0442\u043e\u0447\u043d\u043e\u0439 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u044b\u043b\u0438 \u0432\u043d\u0435\u0441\u0435\u043d\u044b \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0432 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.  <\/p>\n<p><strong>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b <\/strong>(\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u0442\u044c\u0438): \u0414\u0440\u0443\u0433\u0438\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0433\u043e \u043e\u043a\u043d\u0430 \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e, \u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (<em>DPM<\/em>). \u0422\u0430\u043a\u0436\u0435, R-CNN \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0440\u0435\u0433\u0438\u043e\u043d\u043e\u0432 (<em>region proposal method<\/em>). \u041e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 <a href=\"http:\/\/datahacker.rs\/deep-learning-bounding-boxes\/\" rel=\"noopener noreferrer nofollow\">bounding box\u2019\u044b<\/a>. \u0417\u0430\u0442\u0435\u043c, \u043d\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0435 bounding box\u2019\u0430\u043c\u0438, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0439, \u0438 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0435 \u0433\u0440\u0430\u043d\u0438\u0446 \u0440\u0430\u043c\u043e\u043a.  <\/p>\n<p>YOLO \u043f\u0435\u0440\u0435\u043e\u0441\u043c\u044b\u0441\u043b\u0438\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0443 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0437\u0430\u0434\u0430\u0447\u0443 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438.&nbsp;\u041e\u043d\u0430 \u0438\u0434\u0435\u0442 \u043e\u0442 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c bounding box\u2019\u043e\u0432 \u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c, \u0435\u0434\u0438\u043d\u0430\u044f \u0441\u0432\u0435\u0440\u0442\u043e\u0447\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e bounding box\u2019\u043e\u0432 \u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0434\u043b\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439.  <\/p>\n<h3>\u0422\u0435\u043e\u0440\u0438\u044f<\/h3>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a YOLO \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0433\u043e \u043e\u043a\u043d\u0430 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0435\u043b\u0435\u043d\u043e \u043d\u0430 \u0441\u0435\u0442\u043a\u0443 \u0441 \u044f\u0447\u0435\u0439\u043a\u0430\u043c\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c<strong> <\/strong><code>S x S<\/code>. \u041a\u0430\u0436\u0434\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f.  <\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043a\u0430\u0436\u0434\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 bounding box\u2019\u043e\u0432. \u0422\u0430\u043a\u0436\u0435, \u043a\u0430\u0436\u0434\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u0435\u0442 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (<em>confidence value<\/em>) \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0439 bounding box\u2019\u043e\u043c. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e \u0438\u043b\u0438 \u0438\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438. \u0422\u043e \u0435\u0441\u0442\u044c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u044f\u0447\u0435\u0439\u043a\u0430 \u0441\u0435\u0442\u043a\u0438 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0431\u044b\u043b\u043e \u043d\u0438\u0437\u043a\u0438\u043c. <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u0430\u0440\u0442\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u043e \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e, \u0440\u0430\u043c\u043a\u0438. <\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043a\u0430\u0436\u0434\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u042d\u0442\u043e \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u044f\u0447\u0435\u0439\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442, \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0435\u0441\u043b\u0438 \u044f\u0447\u0435\u0439\u043a\u0430 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044c, \u044d\u0442\u043e \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044c \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u043d\u0435\u0439. \u042d\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043b\u0438\u0448\u044c&nbsp; \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442, \u0442\u043e \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044c.  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439 \u043e\u043f\u0438\u0448\u0435\u043c \u0432\u044b\u0432\u043e\u0434 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>\u0412 YOLO \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f <a href=\"https:\/\/towardsdatascience.com\/anchor-boxes-the-key-to-quality-object-detection-ddf9d612d4f9\" rel=\"noopener noreferrer nofollow\">anchor boxes<\/a> (<em>\u044f\u043a\u043e\u0440\u043d\u044b\u0435 \u0440\u0430\u043c\u043a\u0438 \/ \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u043c\u043a\u0438<\/em>) \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f bounding box\u2019\u043e\u0432. \u0418\u0434\u0435\u044f anchor box\u2019\u043e\u0432 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u043e\u0440\u043c. \u0418 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0434\u0432\u0430 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0441 \u0434\u0432\u0443\u043c\u044f anchor box\u2019\u0430\u043c\u0438 (\u0432 \u0446\u0435\u043b\u043e\u043c, \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u0436\u0435 \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e anchor box\u2019\u043e\u0432). \u042d\u0442\u0438 \u044f\u043a\u043e\u0440\u044f \u0431\u044b\u043b\u0438 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 <a href=\"https:\/\/cocodataset.org\/#home\" rel=\"noopener noreferrer nofollow\">COCO<\/a> (<em>Common Objects in Context<\/em>) \u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u041c\u0435\u0442\u043e\u0434_k-\u0441\u0440\u0435\u0434\u043d\u0438\u0445\" rel=\"noopener noreferrer nofollow\">r nofollow&#187;>k-\u0441\u0440\u0435\u0434\u043d\u0438\u0445<\/a> (<em>K-means clustering<\/em>).  <\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u0435\u0442\u043a\u0430, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442: <\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e bounding box&#8217;\u0430:  <\/p>\n<ul>\n<li>\n<p>4 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b (t<sub>x <\/sub>, t<sub>y <\/sub>, t<sub>w <\/sub>, t<sub>h<\/sub>) <\/p>\n<\/li>\n<li>\n<p>1 objectness error (<em>\u043e\u0448\u0438\u0431\u043a\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438<\/em>), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0442\u043e\u0433\u043e \u0438\u043b\u0438 \u0438\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430  <\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u043b\u0435\u0432\u043e\u0433\u043e \u0443\u0433\u043b\u0430 \u043d\u0430 c<sub>x <\/sub>, c<sub>y<\/sub>&nbsp; \u0442\u043e \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u044b \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c: <\/p>\n<p>\u0433\u0434\u0435 p<sub>w<\/sub> (<em>\u0448\u0438\u0440\u0438\u043d\u0430<\/em>) \u0438 p<sub>h <\/sub>(<em>\u0432\u044b\u0441\u043e\u0442\u0430<\/em>) \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0448\u0438\u0440\u0438\u043d\u0435 \u0438 \u0432\u044b\u0441\u043e\u0442\u0435 bounding box&#8217;\u0430.&nbsp; \u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u0443\u0433\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 YOLOv2, \u0430\u0432\u0442\u043e\u0440\u044b \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u044e\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u044f\u0447\u0435\u0439\u043a\u0438.  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u0432\u044b\u0432\u043e\u0434 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u043d\u0430\u0448\u0435\u0439 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u0412 \u043e\u0431\u0449\u0435\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0437\u0434\u0435\u0441\u044c<code>S x S x [B * (4+1+C)]<\/code> \u0432\u044b\u0432\u043e\u0434\u043e\u0432, \u0433\u0434\u0435 <code>B<\/code> \u2013 \u044d\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e bounding box&#8217;\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u044f\u0447\u0435\u0439\u043a\u0430 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, <code>C<\/code> \u2013 \u044d\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0430\u0441\u0441\u043e\u0432, <code>4<\/code> \u2013 \u0434\u043b\u044f bounding box&#8217;\u043e\u0432, <code>1<\/code> \u2013 \u0434\u043b\u044f objectness prediction (<em>\u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438<\/em>). \u0417\u0430 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0445\u043e\u0434 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0439\u0442\u0438 \u043e\u0442 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u0442\u0435\u043d\u0437\u043e\u0440\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435. \u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e YOLOv3 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u0435\u0442 bounding box&#8217;\u044b \u0432 \u0442\u0440\u0435\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430\u0445.   <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u043c\u044b \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438 \u0443\u043c\u043d\u043e\u0436\u0438\u043c \u0438\u0445 \u043d\u0430 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432\u0441\u0435 bounding box&#8217;\u044b, \u0432\u0437\u0432\u0435\u0448\u0435\u043d\u043d\u044b\u0435 \u043f\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430.  <\/p>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437\u0431\u0430\u0432\u0438\u0442 \u043d\u0430\u0441 \u043e\u0442 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u043e\u0432 \u0441 \u043d\u0438\u0437\u043a\u0438\u043c \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c. \u0414\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0448\u0430\u0433\u0430 \u0432\u0430\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0443 <a href=\"http:\/\/datahacker.rs\/deep-learning-intersection-over-union\/\" rel=\"noopener noreferrer nofollow\">IoU<\/a> (<em>Intersection over Union \/ \u041f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u0434 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c<\/em>). \u042d\u0442\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0440\u0430\u0432\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043f\u043b\u043e\u0449\u0430\u0434\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u043a \u043f\u043b\u043e\u0449\u0430\u0434\u0438 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445.  <\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043c\u043e\u0433\u0443\u0442 \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b, \u0438 \u0447\u0442\u043e\u0431\u044b \u043e\u0442 \u043d\u0438\u0445 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"http:\/\/datahacker.rs\/deep-learning-intersection-over-union\/\" rel=\"noopener noreferrer nofollow\">\u201c\u043f\u043e\u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0435-\u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u0432\u201d<\/a> (<em>non-maximum suppression<\/em>). \u041f\u043e\u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0435-\u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u0432 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c: \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u0435\u0440\u0451\u0442 bounding box \u0441 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u0438 \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0443, \u0437\u0430\u0442\u0435\u043c, \u0441\u0440\u0435\u0434\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0433\u0440\u0430\u043d\u0438\u0447\u0430\u0449\u0438\u0445 bounding box&#8217;\u043e\u0432 \u0441 \u0434\u0430\u043d\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u0432\u043e\u0437\u044c\u043c\u0451\u0442 \u043e\u0434\u0438\u043d \u0441 \u043d\u0430\u0438\u0432\u044b\u0441\u0448\u0438\u043c IoU \u0438 \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e. <\/p>\n<p>\u0412\u0432\u0438\u0434\u0443 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u0441\u0435 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0433\u043e\u043d, \u044d\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u043e\u0447\u0442\u0438 \u0442\u0430\u043a\u0436\u0435 \u0431\u044b\u0441\u0442\u0440\u043e, \u043a\u0430\u043a \u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0432\u0441\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435\u044f\u0432\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442. \u041f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0442\u044c\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u0435, \u0438\u0445 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.  <\/p>\n<figure class=\"\"><figcaption>Yolov3<\/figcaption><\/figure>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e YOLO: <\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/arxiv.org\/pdf\/1506.02640.pdf\" rel=\"noopener noreferrer nofollow\">You Only Look Once: Unified, Real-Time Object Detection<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/arxiv.org\/pdf\/1612.08242.pdf\" rel=\"noopener noreferrer nofollow\">YOLO9000: Better, Faster, Stronger<\/a>  <\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/pjreddie.com\/media\/files\/papers\/YOLOv3.pdf\" rel=\"noopener noreferrer nofollow\">YOLOv3: An Incremental Improvement<\/a>  <\/p>\n<\/li>\n<\/ul>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432 Tensorflow<\/h3>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 YOLO \u044d\u0442\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430 \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u0426\u0435\u043b\u0438\u043a\u043e\u043c \u043d\u043e\u0443\u0442\u0431\u0443\u043a \u0441 \u043a\u043e\u0434\u043e\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430 <a href=\"https:\/\/github.com\/gingermuffin\/YOLOv3-Tensorflow\" rel=\"noopener noreferrer nofollow\">Github<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/www.kaggle.com\/anastasiakim\/yolov3-tensorflow\" rel=\"noopener noreferrer nofollow\">Kaggle<\/a>:  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u043e\u043b\u043d\u0443\u044e \u0441\u0432\u0435\u0440\u0442\u043e\u0447\u043d\u0443\u044e \u0441\u0435\u0442\u044c (<em>fully convolutional network \/ FCN<\/em>) \u0431\u0435\u0437 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u0443 \u0441\u0435\u0442\u044c \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0432\u0435\u0441\u0430 \u043e\u0442 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u042d\u0442\u0438 \u0432\u0435\u0441\u0430 \u0431\u044b\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u043e\u0442 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f YOLOv3 \u043d\u0430 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 <a href=\"https:\/\/cocodataset.org\/#home\" rel=\"noopener noreferrer nofollow\">COCO<\/a> (<em>Common Objects in Context<\/em>). \u0424\u0430\u0439\u043b \u0441 \u0432\u0435\u0441\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"https:\/\/pjreddie.com\/media\/files\/yolov3.weights\" rel=\"noopener noreferrer nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430<\/a>.  <\/p>\n<pre><code class=\"python\"># \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u0434\u043b\u044f checkpoint'\u043e\u0432 \u0441 \u0432\u0435\u0441\u0430\u043c\u0438. # !mkdir checkpoints  # \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0441 \u0432\u0435\u0441\u0430\u043c\u0438 \u0434\u043b\u044f YOLOv3 \u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430. # !wget https:\/\/pjreddie.com\/media\/files\/yolov3.weights  # \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. import cv2 import numpy as np  import tensorflow as tf   from absl import logging from itertools import repeat from PIL import Image  from tensorflow.keras import Model from tensorflow.keras.layers import Add, Concatenate, Lambda from tensorflow.keras.layers import Conv2D, Input, LeakyReLU from tensorflow.keras.layers import MaxPool2D, UpSampling2D, ZeroPadding2D from tensorflow.keras.regularizers import l2 from tensorflow.keras.losses import binary_crossentropy from tensorflow.keras.losses import sparse_categorical_crossentropy  yolo_iou_threshold = 0.6 # Intersection Over Union (iou) threshold. yolo_score_threshold = 0.6 # Score threshold.  weightyolov3 = 'yolov3.weights' # \u041f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u0441 \u0432\u0435\u0441\u0430\u043c\u0438. size = 416 # \u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.  checkpoints = 'checkpoints\/yolov3.tf' # \u041f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u0441 checkpoint'\u043e\u043c. num_classes = 80 # \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432 \u043c\u043e\u0434\u0435\u043b\u0438.  # \u0421\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0435\u0432 \u0432 YOLOv3 Fully Convolutional Network (FCN). YOLO_V3_LAYERS = [     'yolo_darknet',     'yolo_conv_0',     'yolo_output_0',     'yolo_conv_1',     'yolo_output_1',     'yolo_conv_2',     'yolo_output_2' ]<\/code><\/pre>\n<p>\u041f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u043b\u043e\u0435\u0432 \u0432 <a href=\"https:\/\/pjreddie.com\/darknet\/yolo\/\" rel=\"noopener noreferrer nofollow\">Darknet <\/a>(<em>open source NN framework<\/em>) \u0438 tf.keras \u0440\u0430\u0437\u043d\u044b\u0435, \u0442\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432\u0435\u0441\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0447\u0438\u0441\u0442\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e API \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0432 keras. TF Checkpoints \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043d\u044b \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u0434\u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438 \u043e\u043d\u0438 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f Tensorflow.  <\/p>\n<pre><code class=\"python\"># \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432\u0435\u0441\u043e\u0432 \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. def load_darknet_weights(model, weights_file):     wf = open(weights_file, 'rb')     major, minor, revision, seen, _ = np.fromfile(wf, dtype=np.int32, count=5)     layers = YOLO_V3_LAYERS      for layer_name in layers:         sub_model = model.get_layer(layer_name)         for i, layer in enumerate(sub_model.layers):             if not layer.name.startswith('conv2d'):                 continue             batch_norm = None             if i + 1 &lt; len(sub_model.layers) and \\                 sub_model.layers[i + 1].name.startswith('batch_norm'):                     batch_norm = sub_model.layers[i + 1]              logging.info(\"{}\/{} {}\".format(                 sub_model.name, layer.name, 'bn' if batch_norm else 'bias'))                          filters = layer.filters             size = layer.kernel_size[0]             in_dim = layer.input_shape[-1]              if batch_norm is None:                 conv_bias = np.fromfile(wf, dtype=np.float32, count=filters)             else:                 bn_weights = np.fromfile(wf, dtype=np.float32, count=4*filters)                 bn_weights =<\/code><\/pre>\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-322782","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/322782","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=322782"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/322782\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=322782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=322782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=322782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}