{"id":381751,"date":"2024-06-29T03:51:12","date_gmt":"2024-06-29T03:51:12","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=381751"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=381751","title":{"rendered":"<span>Yolo \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u043c \u0431\u0435\u0437 \u043f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0421\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u044f \u043a\u0430\u043a-\u0442\u043e \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445. \u0418\u0434\u0435\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c YOLO \u043f\u0440\u0438\u0448\u043b\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u043e\u0434\u0435\u043b\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u043b\u0430 \u043f\u043e \u043c\u043d\u043e\u0433\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c. \u042f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0441 \u0433\u0440\u0443\u0441\u0442\u044c\u044e \u043e\u0441\u043e\u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u043e\u043d\u0430 \u0432\u044b\u0434\u0430\u0435\u0442 \u043d\u0435 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044e \u0431\u043e\u043a\u0441\u044b, \u043a\u043b\u0430\u0441\u0441\u044b \u0438 \u0441\u043a\u043e\u0440\u044b, \u0430 \u0442\u0440\u0443\u0434\u043d\u043e \u043f\u043e\u0434\u0434\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c\u0443 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u043a\u0430\u0441\u043a\u0430\u0434 \u0434\u0435\u0442\u0435\u043a\u0446\u0438\u0439:   <\/p>\n<figure class=\"bordered full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/cc6\/de5\/c7e\/cc6de5c7eea3a21a8cf6669a962060b0.jpg\" alt=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 1\" title=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 1\" width=\"744\" height=\"523\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cc6\/de5\/c7e\/cc6de5c7eea3a21a8cf6669a962060b0.jpg\" data-blurred=\"true\"\/><figcaption>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 1<\/figcaption><\/figure>\n<p>\u0412\u043e \u0432\u0441\u0435\u0445 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u043c\u043d\u043e\u0439 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430\u0445 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u0445 \u0438 \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u043b\u043e\u0441\u044c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043d\u0430 \u0434\u0435\u0432\u0435\u0439\u0441\u0435, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0438\u0437\u043e\u0431\u0438\u043b\u0443\u044e\u0449\u0438\u0445 \u043b\u0438\u0448\u0435\u043d\u043d\u044b\u043c\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430\u043c\u0438. <\/p>\n<p>\u0418, \u0435\u0441\u043b\u0438 \u0441 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043e\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u044f \u0432 \u0446\u0435\u043b\u043e\u043c \u0441\u043c\u0438\u0440\u0438\u043b\u0441\u044f, \u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0435\u0449\u0435 \u0438 \u043f\u043e\u0441\u0442-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c YOLO \u0441\u043a\u0430\u0436\u0435\u043c \u0432 Colab, \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u044b\u0434\u0430\u0441\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 Detections, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/7e5\/8d5\/17a\/7e58d517acb91a85b3576eb28f2fa9d0.jpg\" width=\"960\" height=\"463\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7e5\/8d5\/17a\/7e58d517acb91a85b3576eb28f2fa9d0.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u0432\u0435\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043a\u043e\u0434 \u0443\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0435\u0433\u043e \u043d\u0430\u0434\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f. \u0412\u0435\u0434\u044c \u043c\u044b \u0436\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u044c, \u043d\u0435 \u0442\u0430\u043a \u043b\u0438? <\/p>\n<p>\u041d\u0430\u0439\u0442\u0438 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u0430\u043c\u043e\u043c\u0443. \u0414\u0430\u043b\u0435\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043a\u0440\u0430\u0442\u043a\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u043e\u0437\u043d\u0438\u043a\u0448\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<h2>\u0427\u0442\u043e \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<\/h2>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043c\u043e\u0434\u0435\u043b\u0438: <a href=\"https:\/\/github.com\/ultralytics\/yolov5\" rel=\"noopener noreferrer nofollow\">YOLOv5 \u043e\u0442 Ultralytics<\/a><\/p>\n<p>\u0414\u0430\u0442\u0430\u0441\u0435\u0442 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438: <a href=\"https:\/\/universe.roboflow.com\/pricecarddemo\/numbers-sdsol\" rel=\"noopener noreferrer nofollow\">\u00a0NUMBERS CV<\/a><\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438:<\/p>\n<p>pytorch_android_lite \u0434\u043b\u044f Java (\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0444\u043e\u0440\u043c\u0430\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 ptl)<\/p>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0432\u044b\u0445\u043e\u0434\u044b \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f, \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0443\u0434\u0430 \u0438 \u043a\u0430\u043a\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043d\u043e\u0441\u0438\u0442\u044c. <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/479\/242\/654\/479242654caa5bc672084b940f05c11b.jpg\" width=\"1432\" height=\"481\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/479\/242\/654\/479242654caa5bc672084b940f05c11b.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, DetectionModel \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043f\u0430\u043a\u0443\u0435\u043c\u044b\u043c \u0432 \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u043a\u043b\u0430\u0441\u0441\u043e\u043c. \u0418\u043c\u0435\u043d\u043d\u043e \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f forward \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u00a0<\/p>\n<p>\u0412 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f, \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u0430\u044f \u0438\u0437 \u0445\u0430\u0431\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 Detections, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 AutoShape. \u0414\u0443\u043c\u0430\u044e, \u0443\u0436\u0435 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u0442\u0443\u0434\u0430 \u043f\u0430\u043a\u0443\u044e\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u0432 non_max_suppression.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/eb7\/8cc\/b28\/eb78ccb286bd867399522646f48754c3.jpg\" width=\"994\" height=\"751\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/eb7\/8cc\/b28\/eb78ccb286bd867399522646f48754c3.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0432 DetectionModel non_max_suppression, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 utils\/general.py, \u0442\u043e jit.trace \u0432\u044b\u0434\u0430\u0441\u0442 \u043e\u0448\u0438\u0431\u043a\u0443. \u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u043a\u0440\u043e\u0435\u0442\u0441\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u0447\u043a\u0430\u0445 \u0438\u0437 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 (\u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u0443 \u0442\u0440\u0435\u0439\u0441\u0435\u0440\u0430 \u043f\u0440\u0438\u0441\u0442\u0443\u043f \u043f\u0430\u043d\u0438\u043a\u0438) \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0443\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u0441\u043a\u0440\u0438\u043f\u0442. \u0427\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u00ab\u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e\u00bb \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443\u0436\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0430 <code>multi_label &amp;= nc > 1<\/code> \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0443 \u0442\u0440\u0435\u0439\u0441\u0435\u0440\u0430 \u0441\u0442\u043e\u0439\u043a\u043e\u0435 \u043d\u0435\u0441\u0432\u0430\u0440\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438 \u0441 <code>[conf.view(-1)\u00a0>\u00a0conf_thres]<\/code> \u0432 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 <code>x\u00a0=\u00a0torch.cat((box,\u00a0conf,\u00a0j.float(),\u00a0mask),\u00a01)[conf.view(-1)\u00a0>\u00a0conf_thres]<\/code>.<\/p>\n<p>\u042f \u043f\u043e\u0437\u0432\u043e\u043b\u044e \u0441\u0435\u0431\u0435 \u0432\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f. \u0421\u043a\u0430\u0436\u0443 \u043b\u0438\u0448\u044c, \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0434 \u0441\u0432\u043e\u0438 \u043d\u0443\u0436\u0434\u044b. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0432\u0441\u0435 \u044d\u0442\u0438 \u0440\u0430\u0441\u0447\u0435\u0442\u044b \u2013 \u043b\u0438\u0448\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0433\u043b\u0430\u0432\u043d\u043e\u043c\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e: \u0432\u044b\u0437\u043e\u0432\u0443 torchvision.ops.nms, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<p>\u0417\u0430\u0431\u0435\u0433\u0430\u044f \u0432\u043f\u0435\u0440\u0435\u0434, \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0441 \u043d\u0438\u043c \u0435\u0449\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0442.\u043a. \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044e \u043a \u043d\u0435\u043c\u0443 \u043d\u0435 \u043f\u0430\u043a\u0443\u044e\u0442\u0441\u044f \u0432 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438), \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u0432\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442: jit.trace \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u0438\u0448\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0435 \u0442\u0435\u043d\u0437\u043e\u0440\u044b, \u043a\u043e\u0440\u0442\u0435\u0436\u0438 \u0442\u0435\u043d\u0437\u043e\u0440\u043e\u0432 \u0438 \u0442.\u0434. \u044d\u0442\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c.<\/p>\n<h2>\u0418\u0442\u0430\u043a<\/h2>\n<p>\u0412 models\/experimental.py \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0434\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<p>\u041e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u043d\u044b\u0439 nms:<\/p>\n<pre><code class=\"python\">def nms_lite(prediction, conf_thres=0.25, iou_thres=0.45, max_det=300, nm=0):   #nm - musk's number        if isinstance(prediction, (list, tuple)):  # YOLOv5 model in validation model, output = (inference_out, loss_out)         prediction = prediction[0]  # select only inference output          device = prediction.device     mps = 'mps' in device.type  # Apple MPS     if mps:  # MPS not fully supported yet, convert tensors to CPU before NMS         prediction = prediction.cpu()     bs = prediction.shape[0]  # batch size     nc = prediction.shape[2] - nm - 5  # number of classes     xc = prediction[..., 4] > conf_thres  # candidates          # Checks     assert 0 &lt;= iou_thres &lt;= 1, f'Invalid IoU {iou_thres}, valid values are between 0.0 and 1.0'          # Settings     max_wh = 7680  # (pixels) maximum box width and height     max_nms = 30000  # maximum number of boxes into torchvision.ops.nms()     time_limit = 0.5 + 0.05 * bs  # seconds to quit after     redundant = True  # require redundant detections        merge = False  # use merge-NMS          mi = 5 + nc  # mask start index     output = [torch.zeros((0, 6 + nm), device=prediction.device)] * bs      for xi, x in enumerate(prediction):  # image index, image inference         # Apply constraints         # x[((x[..., 2:4] &lt; min_wh) | (x[..., 2:4] > max_wh)).any(1), 4] = 0  # width-height         x = x[xc[xi]]  # confidence                   # Compute conf         x[:, 5:] *= x[:, 4:5]  # conf = obj_conf * cls_conf                  # Box\/Mask         box = xywh2xyxy(x[:, :4])  # center_x, center_y, width, height) to (x1, y1, x2, y2)         mask = x[:, mi:]  # zero columns if no masks         conf, j = x[:, 5:mi].max(1, keepdim=True)                          x= torch.cat((box, conf, j.float(), mask), 1)         x= x[x[:, 4].argsort(descending=True)]         c = x[:, 5:6] * max_wh         boxes, scores = x[:, :4] + c, x[:, 4]                 i = torchvision.ops.nms(boxes, scores, float(iou_thres))           output[xi] = x[i]         if mps:             output[xi] = output[xi].to(device)        return output <\/code><\/pre>\n<p>\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a:   <\/p>\n<pre><code class=\"python\">def new_sorter(non_max, theshhold):     sort_result=non_max[non_max[:,0].sort()[1]]   sort_result=sort_result[sort_result[:,4]>theshhold]   sort_result=sort_result[:,5]      return sort_result<\/code><\/pre>\n<p>\u0420\u0430\u0437 \u0443\u0436 \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0442\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0443\u0436 \u0438 \u043a\u043b\u0430\u0441\u0441\u044b \u043d\u0438 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0442\u044c, \u0437\u0430\u043e\u0434\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u0436\u043d\u043e\u0435. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0431\u043e\u043a\u0441\u044b \u043f\u043e \u043e\u0441\u0438 \u0425, \u0443\u0431\u0438\u0440\u0430\u0435\u0442 \u0442\u0435 \u043f\u0440\u0435\u0434\u0438\u043a\u0442\u044b, \u0441\u043a\u043e\u0440\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0442 treshhold \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043d\u0437\u043e\u0440 \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u0438\u0437 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432 \u043a\u043b\u0430\u0441\u0441 DetectionModel \u0432 models\/yolo.py \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b:<\/p>\n<p>\u0424\u043b\u0430\u0433: <code>is_export=False<\/code><\/p>\n<p>\u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043b\u0438\u0448\u044c \u043f\u0440\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435 \u0438 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430 \u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439, \u0435\u0441\u043b\u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0435\u0449\u0435 \u0440\u0430\u0437 \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0435 \u0432\u043b\u0438\u044f\u043b\u0438 \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443: <code>treshhold=0.8<\/code><\/p>\n<p>\u0414\u0435\u0442\u0430\u043a\u0446\u0438\u0438 \u043d\u0438\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0435\u043a\u0430\u0442\u044c \u0441\u043e\u0440\u0442\u0435\u0440.\u00a0<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044e forward \u043a\u043b\u0430\u0441\u0441\u0430 DetectionModel \u044f \u043f\u043e\u0434\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043d\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0438\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0444\u043b\u0430\u0433\u0430 <code>is_export=True<\/code><\/p>\n<pre><code class=\"python\">if augment and not self.is_export:             return self._forward_augment(x)  # augmented inference, None         out=self._forward_once(x, profile, visualize) #base return         if self.is_export: #and not augment             #a=nms_lite(out)[0]             return new_sorter(nms_lite(out)[0], self.treshhold)         else:             return out<\/code><\/pre>\n<p>\u0412 export.py \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 <\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u0438\u043b \u0441\u0442\u0440\u043e\u0447\u043a\u0443 120 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 export_torchscript \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0441 \u043d\u0443\u0436\u043d\u044b\u043c \u043c\u043d\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c <\/p>\n<p>\u0441 <code>f = file.with_suffix('.torchscript')<\/code> <\/p>\n<p>\u043d\u0430 <code>f = file.with_suffix('.torchscript.ptl')<\/code><\/p>\n<p>\u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 run \u043f\u043e\u0441\u043b\u0435 model.eval() (\u0441\u0442\u0440\u043e\u043a\u0430 541) \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0444\u043b\u0430\u0433\u0430:<\/p>\n<p><code>model.is_export=True<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0432\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0438.<\/p>\n<p>\u042f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u043c\u043e\u0434\u0435\u043b\u044c, \u0443\u043a\u0430\u0437\u0430\u0432 \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438: \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (\u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0439 \u0441\u0435\u0442 \u0431\u044b\u043b 416 \u043d\u0430 416), \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0430\u0442\u0447\u0430 (\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u044f \u0431\u0443\u0434\u0443 \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e 1 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0437\u0430 \u0440\u0430\u0437), \u0432\u043a\u043b\u044e\u0447\u0438\u043b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e (\u0435\u0441\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430), \u0438 \u0443\u043a\u0430\u0437\u0430\u043b \u0444\u043e\u0440\u043c\u0430\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430.<\/p>\n<pre><code class=\"python\">!python export.py --data NUMBERS-1\/data.yaml --weights runs\/train\/exp\/weights\/best.pt --imgsz 416 416 --batch-size 1 --optimize --include torchscript <\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043b \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b LiteModuleLoader.<em>load<\/em> \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b: <\/p>\n<blockquote>\n<p>Following ops cannot be found. Please check if the operator library is included in the build. If built with selected ops, check if these ops are in the list. If you are a Meta employee, please see fburl.com\/missing_ops for a fix. Or post it in https:\/\/discuss.pytorch.org\/torchvision::nms ()<\/p>\n<\/blockquote>\n<p>\u0412\u044b\u0448\u0435 \u044f \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u043e\u0431 \u044d\u0442\u043e\u043c. \u0418 \u0445\u043e\u0442\u044f, \u0432 \u0446\u0435\u043b\u043e\u043c, \u0432\u0440\u043e\u0434\u0435 \u0431\u044b, \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043d\u0430\u0439\u0442\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e, \u043f\u043e-\u0432\u0438\u0434\u0438\u043c\u043e\u043c\u0443, \u044d\u0442\u043e \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430.<\/p>\n<p>\u0414\u043b\u044f \u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u043b\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 build.gradle<\/p>\n<pre><code class=\"java\">implementation 'org.pytorch:torchvision_ops:0.13.1' implementation 'com.facebook.soloader:nativeloader:0.8.0'<\/code><\/pre>\n<p>\u0418 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c torchvision_ops \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u043c\u0435\u0441\u0442\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 onCreate \u0432 MainActivity<\/p>\n<pre><code class=\"java\">if (!NativeLoader.isInitialized()) {     NativeLoader.init(new SystemDelegate()); } NativeLoader.loadLibrary(\"torchvision_ops\");<\/code><\/pre>\n<p>\u0414\u0443\u043c\u0430\u044e, \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u043c\u0438\u043c\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0432 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 \u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432 \u0442\u0435\u043d\u0437\u043e\u0440, \u043d\u0438\u043a\u0430\u043a\u0430\u044f \u0434\u0440\u0443\u0433\u0430\u044f \u043f\u0440\u0435\u0434\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. \u0421 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043a\u0430\u043c\u0435\u0440\u044b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"java\">bitmap = Bitmap.createScaledBitmap(bitmap, 416, 416, true);  final Tensor t = TensorImageUtils.bitmapToFloat32Tensor(bitmap, NO_MEAN_RGB, NO_STD_RGB); <\/code><\/pre>\n<p>\u0433\u0434\u0435 <em>NO_MEAN_RGB<\/em>, \u0438 <em>NO_STD_RGB <\/em>\u043c\u0430\u0441\u0441\u0438\u0432\u044b \u2013 \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u043e\u0441\u044c:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/17a\/05b\/09e\/17a05b09eafddde16a44a58368376256.jpg\" width=\"379\" height=\"786\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/17a\/05b\/09e\/17a05b09eafddde16a44a58368376256.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0430\u043c: <br \/><a href=\"https:\/\/github.com\/Gainward777\/yolov5\" rel=\"noopener noreferrer nofollow\">\u041e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c<\/a> <br \/><a href=\"https:\/\/github.com\/Gainward777\/yolov5_custom_training\" rel=\"noopener noreferrer nofollow\">\u041d\u043e\u0443\u0442\u0431\u0443\u043a \u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u043e\u043c<\/a> <br \/><a href=\"https:\/\/github.com\/Gainward777\/Pricer\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/a><\/p>\n<p>\u0412 \u0441\u0438\u043b\u0443 \u043d\u0435\u043e\u043f\u044b\u0442\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0433 \u0447\u0442\u043e-\u0442\u043e \u0443\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041d\u0435\u0432\u0437\u0438\u0440\u0430\u044f \u043d\u0430 \u044d\u0442\u043e, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0438 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0435\u0442\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u043a\u0440\u0438\u0442\u0438\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f. \u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u0432\u0441\u0435\u0445 \u043a \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u0438.<\/p>\n<p>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b:<br \/><a href=\"https:\/\/github.com\/pytorch\/android-demo-app\/blob\/master\/ObjectDetection\/README.md\" rel=\"noopener noreferrer nofollow\">\u041a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 .ptl<\/a><br \/><a href=\"https:\/\/pavcreations.com\/torchvision-no-such-operator-torchvisionnms-fix\/\" rel=\"noopener noreferrer nofollow\">\u0424\u0438\u043a\u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 torchvision_ops (\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 C++)<\/a><br \/><a href=\"https:\/\/discuss.pytorch.org\/t\/torchvision-ops-nms-on-android-mobile\/81017\/6\" rel=\"noopener noreferrer nofollow\">\u0424\u0438\u043a\u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 torchvision_ops (Java)<\/a><br \/><a href=\"https:\/\/github.com\/pytorch\/android-demo-app\/tree\/master\/D2Go\" rel=\"noopener noreferrer nofollow\">\u0421\u043d\u043e\u0432\u0430 \u043f\u0440\u043e torchvision_ops (\u043a\u0430\u043a \u044f \u043f\u043e\u043d\u044f\u043b \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, Java)<\/a><br \/><a href=\"https:\/\/learnopencv.com\/non-maximum-suppression-theory-and-implementation-in-pytorch\/\" rel=\"noopener noreferrer nofollow\">\u0421\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e nms (Python), \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e.<\/a>  <\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/707298\/\"> https:\/\/habr.com\/ru\/articles\/707298\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0421\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u044f \u043a\u0430\u043a-\u0442\u043e \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445. \u0418\u0434\u0435\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c YOLO \u043f\u0440\u0438\u0448\u043b\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u043e\u0434\u0435\u043b\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u043b\u0430 \u043f\u043e \u043c\u043d\u043e\u0433\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c. \u042f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0441 \u0433\u0440\u0443\u0441\u0442\u044c\u044e \u043e\u0441\u043e\u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u043e\u043d\u0430 \u0432\u044b\u0434\u0430\u0435\u0442 \u043d\u0435 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044e \u0431\u043e\u043a\u0441\u044b, \u043a\u043b\u0430\u0441\u0441\u044b \u0438 \u0441\u043a\u043e\u0440\u044b, \u0430 \u0442\u0440\u0443\u0434\u043d\u043e \u043f\u043e\u0434\u0434\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c\u0443 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u043a\u0430\u0441\u043a\u0430\u0434 \u0434\u0435\u0442\u0435\u043a\u0446\u0438\u0439:   <\/p>\n<figure class=\"bordered full-width\"><figcaption>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 1<\/figcaption><\/figure>\n<p>\u0412\u043e \u0432\u0441\u0435\u0445 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u043c\u043d\u043e\u0439 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430\u0445 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u0445 \u0438 \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u043b\u043e\u0441\u044c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043d\u0430 \u0434\u0435\u0432\u0435\u0439\u0441\u0435, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0438\u0437\u043e\u0431\u0438\u043b\u0443\u044e\u0449\u0438\u0445 \u043b\u0438\u0448\u0435\u043d\u043d\u044b\u043c\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430\u043c\u0438. <\/p>\n<p>\u0418, \u0435\u0441\u043b\u0438 \u0441 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043e\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u044f \u0432 \u0446\u0435\u043b\u043e\u043c \u0441\u043c\u0438\u0440\u0438\u043b\u0441\u044f, \u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0435\u0449\u0435 \u0438 \u043f\u043e\u0441\u0442-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c YOLO \u0441\u043a\u0430\u0436\u0435\u043c \u0432 Colab, \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u044b\u0434\u0430\u0441\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 Detections, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u0432\u0435\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043a\u043e\u0434 \u0443\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0435\u0433\u043e \u043d\u0430\u0434\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f. \u0412\u0435\u0434\u044c \u043c\u044b \u0436\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u044c, \u043d\u0435 \u0442\u0430\u043a \u043b\u0438? <\/p>\n<p>\u041d\u0430\u0439\u0442\u0438 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u0430\u043c\u043e\u043c\u0443. \u0414\u0430\u043b\u0435\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043a\u0440\u0430\u0442\u043a\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u043e\u0437\u043d\u0438\u043a\u0448\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<h2>\u0427\u0442\u043e \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<\/h2>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043c\u043e\u0434\u0435\u043b\u0438: <a href=\"https:\/\/github.com\/ultralytics\/yolov5\" rel=\"noopener noreferrer nofollow\">YOLOv5 \u043e\u0442 Ultralytics<\/a><\/p>\n<p>\u0414\u0430\u0442\u0430\u0441\u0435\u0442 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438: <a href=\"https:\/\/universe.roboflow.com\/pricecarddemo\/numbers-sdsol\" rel=\"noopener noreferrer nofollow\">\u00a0NUMBERS CV<\/a><\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438:<\/p>\n<p>pytorch_android_lite \u0434\u043b\u044f Java (\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0444\u043e\u0440\u043c\u0430\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 ptl)<\/p>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0432\u044b\u0445\u043e\u0434\u044b \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f, \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0443\u0434\u0430 \u0438 \u043a\u0430\u043a\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043d\u043e\u0441\u0438\u0442\u044c. <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, DetectionModel \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043f\u0430\u043a\u0443\u0435\u043c\u044b\u043c \u0432 \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u043a\u043b\u0430\u0441\u0441\u043e\u043c. \u0418\u043c\u0435\u043d\u043d\u043e \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f forward \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u00a0<\/p>\n<p>\u0412 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f, \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u0430\u044f \u0438\u0437 \u0445\u0430\u0431\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 Detections, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 AutoShape. \u0414\u0443\u043c\u0430\u044e, \u0443\u0436\u0435 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u0442\u0443\u0434\u0430 \u043f\u0430\u043a\u0443\u044e\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u0432 non_max_suppression.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0432 DetectionModel non_max_suppression, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 utils\/general.py, \u0442\u043e jit.trace \u0432\u044b\u0434\u0430\u0441\u0442 \u043e\u0448\u0438\u0431\u043a\u0443. \u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u043a\u0440\u043e\u0435\u0442\u0441\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u0447\u043a\u0430\u0445 \u0438\u0437 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 (\u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u0443 \u0442\u0440\u0435\u0439\u0441\u0435\u0440\u0430 \u043f\u0440\u0438\u0441\u0442\u0443\u043f \u043f\u0430\u043d\u0438\u043a\u0438) \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0443\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u0441\u043a\u0440\u0438\u043f\u0442. \u0427\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u00ab\u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e\u00bb \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443\u0436\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0430 <code>multi_label &amp;= nc > 1<\/code> \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0443 \u0442\u0440\u0435\u0439\u0441\u0435\u0440\u0430 \u0441\u0442\u043e\u0439\u043a\u043e\u0435 \u043d\u0435\u0441\u0432\u0430\u0440\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438 \u0441 <code>[conf.view(-1)\u00a0>\u00a0conf_thres]<\/code> \u0432 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 <code>x\u00a0=\u00a0torch.cat((box,\u00a0conf,\u00a0j.float(),\u00a0mask),\u00a01)[conf.view(-1)\u00a0>\u00a0conf_thres]<\/code>.<\/p>\n<p>\u042f \u043f\u043e\u0437\u0432\u043e\u043b\u044e \u0441\u0435\u0431\u0435 \u0432\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f. \u0421\u043a\u0430\u0436\u0443 \u043b\u0438\u0448\u044c, \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0434 \u0441\u0432\u043e\u0438 \u043d\u0443\u0436\u0434\u044b. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0432\u0441\u0435 \u044d\u0442\u0438 \u0440\u0430\u0441\u0447\u0435\u0442\u044b \u2013 \u043b\u0438\u0448\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0433\u043b\u0430\u0432\u043d\u043e\u043c\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e: \u0432\u044b\u0437\u043e\u0432\u0443 torchvision.ops.nms, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<p>\u0417\u0430\u0431\u0435\u0433\u0430\u044f \u0432\u043f\u0435\u0440\u0435\u0434, \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0441 \u043d\u0438\u043c \u0435\u0449\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0442.\u043a. \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044e \u043a \u043d\u0435\u043c\u0443 \u043d\u0435 \u043f\u0430\u043a\u0443\u044e\u0442\u0441\u044f \u0432 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438), \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u0432\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442: jit.trace \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u0438\u0448\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0435 \u0442\u0435\u043d\u0437\u043e\u0440\u044b, \u043a\u043e\u0440\u0442\u0435\u0436\u0438 \u0442\u0435\u043d\u0437\u043e\u0440\u043e\u0432 \u0438 \u0442.\u0434. \u044d\u0442\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c.<\/p>\n<h2>\u0418\u0442\u0430\u043a<\/h2>\n<p>\u0412 models\/experimental.py \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0434\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<p>\u041e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u043d\u044b\u0439 nms:<\/p>\n<pre><code class=\"python\">def nms_lite(prediction, conf_thres=0.25, iou_thres=0.45, max_det=300, nm=0):   #nm - musk's number        if isinstance(prediction, (list, tuple)):  # YOLOv5 model in validation model, output = (inference_out, loss_out)         prediction = prediction[0]  # select only inference output          device = prediction.device     mps = 'mps' in device.type  # Apple MPS     if mps:  # MPS not fully supported yet, convert tensors to CPU before NMS         prediction = prediction.cpu()     bs = prediction.shape[0]  # batch size     nc = prediction.shape[2] - nm - 5  # number of classes     xc = prediction[..., 4] > conf_thres  # candidates          # Checks     assert 0 &lt;= iou_thres &lt;= 1, f'Invalid IoU {iou_thres}, valid values are between 0.0 and 1.0'          # Settings     max_wh = 7680  # (pixels) maximum box width and height     max_nms = 30000  # maximum number of boxes into torchvision.ops.nms()     time_limit = 0.5 + 0.05 * bs  # seconds to quit after     redundant = True  # require redundant detections        merge = False  # use merge-NMS          mi = 5 + nc  # mask start index     output = [torch.zeros((0, 6 + nm), device=prediction.device)] * bs      for xi, x in enumerate(prediction):  # image index, image inference         # Apply constraints         # x[((x[..., 2:4] &lt; min_wh) | (x[..., 2:4] > max_wh)).any(1), 4] = 0  # width-height         x = x[xc[xi]]  # confidence                   # Compute conf         x[:, 5:] *= x[:, 4:5]  # conf = obj_conf * cls_conf                  # Box\/Mask         box = xywh2xyxy(x[:, :4])  # center_x, center_y, width, height) to (x1, y1, x2, y2)         mask = x[:, mi:]  # zero columns if no masks         conf, j = x[:, 5:mi].max(1, keepdim=True)                          x= torch.cat((box, conf, j.float(), mask), 1)         x= x[x[:, 4].argsort(descending=True)]         c = x[:, 5:6] * max_wh         boxes, scores = x[:, :4] + c, x[:, 4]                 i = torchvision.ops.nms(boxes, scores, float(iou_thres))           output[xi] = x[i]         if mps:             output[xi] = output[xi].to(device)        return output <\/code><\/pre>\n<p>\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a:   <\/p>\n<pre><code class=\"python\">def new_sorter(non_max, theshhold):     sort_result=non_max[non_max[:,0].sort()[1]]   sort_result=sort_result[sort_result[:,4]>theshhold]   sort_result=sort_result[:,5]      return sort_result<\/code><\/pre>\n<p>\u0420\u0430\u0437 \u0443\u0436 \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0442\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0443\u0436 \u0438 \u043a\u043b\u0430\u0441\u0441\u044b \u043d\u0438 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0442\u044c, \u0437\u0430\u043e\u0434\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u0436\u043d\u043e\u0435. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0431\u043e\u043a\u0441\u044b \u043f\u043e \u043e\u0441\u0438 \u0425, \u0443\u0431\u0438\u0440\u0430\u0435\u0442 \u0442\u0435 \u043f\u0440\u0435\u0434\u0438\u043a\u0442\u044b, \u0441\u043a\u043e\u0440\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0442 treshhold \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043d\u0437\u043e\u0440 \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u0438\u0437 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432 \u043a\u043b\u0430\u0441\u0441 DetectionModel \u0432 models\/yolo.py \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b:<\/p>\n<p>\u0424\u043b\u0430\u0433: <code>is_export=False<\/code><\/p>\n<p>\u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043b\u0438\u0448\u044c \u043f\u0440\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435 \u0438 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430 \u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439, \u0435\u0441\u043b\u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0435\u0449\u0435 \u0440\u0430\u0437 \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0435 \u0432\u043b\u0438\u044f\u043b\u0438 \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443: <code>treshhold=0.8<\/code><\/p>\n<p>\u0414\u0435\u0442\u0430\u043a\u0446\u0438\u0438 \u043d\u0438\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0435\u043a\u0430\u0442\u044c \u0441\u043e\u0440\u0442\u0435\u0440.\u00a0<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044e forward \u043a\u043b\u0430\u0441\u0441\u0430 DetectionModel \u044f \u043f\u043e\u0434\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043d\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0438\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0444\u043b\u0430\u0433\u0430 <code>is_export=True<\/code><\/p>\n<pre><code class=\"python\">if augment and not self.is_export:             return self._forward_augment(x)  # augmented inference, None         out=self._forward_once(x, profile, visualize) #base return         if self.is_export: #and not augment             #a=nms_lite(out)[0]             return new_sorter(nms_lite(out)[0], self.treshhold)         else:             return out<\/code><\/pre>\n<p>\u0412 export.py \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 <\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u0438\u043b \u0441\u0442\u0440\u043e\u0447\u043a\u0443 120 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 export_torchscript \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0441 \u043d\u0443\u0436\u043d\u044b\u043c \u043c\u043d\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c <\/p>\n<p>\u0441 <code>f = file.with_suffix('.torchscript')<\/code> <\/p>\n<p>\u043d\u0430 <code>f = file.with_suffix('.torchscript.ptl')<\/code><\/p>\n<p>\u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 run \u043f\u043e\u0441\u043b\u0435 model.eval() (\u0441\u0442\u0440\u043e\u043a\u0430 541) \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0444\u043b\u0430\u0433\u0430:<\/p>\n<p><code>model.is_export=True<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0432\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0438.<\/p>\n<p>\u042f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u043c\u043e\u0434\u0435\u043b\u044c, \u0443\u043a\u0430\u0437\u0430\u0432 \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438: \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (\u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0439 \u0441\u0435\u0442 \u0431\u044b\u043b 416 \u043d\u0430 416), \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0430\u0442\u0447\u0430 (\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u044f \u0431\u0443\u0434\u0443 \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e 1 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0437\u0430 \u0440\u0430\u0437), \u0432\u043a\u043b\u044e\u0447\u0438\u043b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e (\u0435\u0441\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430), \u0438 \u0443\u043a\u0430\u0437\u0430\u043b \u0444\u043e\u0440\u043c\u0430\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430.<\/p>\n<pre><code class=\"python\">!python export.py --data NUMBERS-1\/data.yaml --weights runs\/train\/exp\/weights\/best.pt --imgsz 416 416 --batch-size 1 --optimize --include torchscript <\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043b \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b LiteModuleLoader.<em>load<\/em> \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b: <\/p>\n<blockquote>\n<p>Following ops cannot be found. Please check if the operator library is included in the build. If built with selected ops, check if these ops are in the list. If you are a Meta employee, please see fburl.com\/missing_ops for a fix. Or post it in https:\/\/discuss.pytorch.org\/torchvision::nms ()<\/p>\n<\/blockquote>\n<p>\u0412\u044b\u0448\u0435 \u044f \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u043e\u0431 \u044d\u0442\u043e\u043c. \u0418 \u0445\u043e\u0442\u044f, \u0432 \u0446\u0435\u043b\u043e\u043c, \u0432\u0440\u043e\u0434\u0435 \u0431\u044b, \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043d\u0430\u0439\u0442\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e, \u043f\u043e-\u0432\u0438\u0434\u0438\u043c\u043e\u043c\u0443, \u044d\u0442\u043e \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430.<\/p>\n<p>\u0414\u043b\u044f \u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u043b\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 build.gradle<\/p>\n<pre><code class=\"java\">implementation 'org.pytorch:torchvision_ops:0.13.1' implementation 'com.facebook.soloader:nativeloader:0.8.0'<\/code><\/pre>\n<p>\u0418 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c torchvision_ops \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u043c\u0435\u0441\u0442\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 onCreate \u0432 MainActivity<\/p>\n<pre><code class=\"java\">if (!NativeLoader.isInitialized()) {     NativeLoader.init(new SystemDelegate()); } NativeLoader.loadLibrary(\"torchvision_ops\");<\/code><\/pre>\n<p>\u0414\u0443\u043c\u0430\u044e, \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u043c\u0438\u043c\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0432 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 \u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432 \u0442\u0435\u043d\u0437\u043e\u0440, \u043d\u0438\u043a\u0430\u043a\u0430\u044f \u0434\u0440\u0443\u0433\u0430\u044f \u043f\u0440\u0435\u0434\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. \u0421 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043a\u0430\u043c\u0435\u0440\u044b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"java\">bitmap = Bitmap.createScaledBitmap(bitmap, 416, 416, true);  final Tensor t = TensorImageUtils.bitmapToFloat32Tensor(bitmap, NO_MEAN_RGB, NO_STD_RGB); <\/code><\/pre>\n<p>\u0433\u0434\u0435 <em>NO_MEAN_RGB<\/em>, \u0438 <em>NO_STD_RGB <\/em>\u043c\u0430\u0441\u0441\u0438\u0432\u044b \u2013 \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u043e\u0441\u044c:<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0430\u043c: <br \/><a href=\"https:\/\/github.com\/Gainward777\/yolov5\" rel=\"noopener noreferrer nofollow\">\u041e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c<\/a> <br \/><a href=\"https:\/\/github.com\/Gainward777\/yolov5_custom_training\" rel=\"noopener noreferrer nofollow\">\u041d\u043e\u0443\u0442\u0431\u0443\u043a \u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u043e\u043c<\/a> <br \/><a href=\"https:\/\/github.com\/Gainward777\/Pricer\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/a><\/p>\n<p>\u0412 \u0441\u0438\u043b\u0443 \u043d\u0435\u043e\u043f\u044b\u0442\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0433 \u0447\u0442\u043e-\u0442\u043e \u0443\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041d\u0435\u0432\u0437\u0438\u0440\u0430\u044f \u043d\u0430 \u044d\u0442\u043e, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0438 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0435\u0442\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u043a\u0440\u0438\u0442\u0438\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f. \u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u0432\u0441\u0435\u0445 \u043a \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u0438.<\/p>\n<p>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b:<br \/><a href=\"https:\/\/github.com\/pytorch\/android-demo-app\/blob\/master\/ObjectDetection\/README.md\" rel=\"noopener noreferrer nofollow\">\u041a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 .ptl<\/a><br \/><a href=\"https:\/\/pavcreations.com\/torchvision-no-such-operator-torchvisionnms-fix\/\" rel=\"noopener noreferrer nofollow\">\u0424\u0438\u043a\u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 torchvision_ops (\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 C++)<\/a><br \/><a href=\"https:\/\/discuss.pytorch.org\/t\/torchvision-ops-nms-on-android-mobile\/81017\/6\" rel=\"noopener noreferrer nofollow\">\u0424\u0438\u043a\u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 torchvision_ops (Java)<\/a><br \/><a href=\"https:\/\/github.com\/pytorch\/android-demo-app\/tree\/master\/D2Go\" rel=\"noopener noreferrer nofollow\">\u0421\u043d\u043e\u0432\u0430 \u043f\u0440\u043e torchvision_ops (\u043a\u0430\u043a \u044f \u043f\u043e\u043d\u044f\u043b \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, Java)<\/a><br \/><a href=\"https:\/\/learnopencv.com\/non-maximum-suppression-theory-and-implementation-in-pytorch\/\" rel=\"noopener noreferrer nofollow\">\u0421\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e nms (Python), \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e.<\/a>  <\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/707298\/\"> https:\/\/habr.com\/ru\/articles\/707298\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-381751","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/381751","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=381751"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/381751\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=381751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=381751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=381751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}