{"id":402171,"date":"2024-06-29T16:20:02","date_gmt":"2024-06-29T16:20:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=402171"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=402171","title":{"rendered":"<span>KotlinDL 0.3: \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 ONNX, Object Detection API, 20+ \u043d\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0432 ModelHub, \u0438 \u043c\u043d\u043e\u0433\u043e \u043d\u043e\u0432\u044b\u0445 \u0441\u043b\u043e\u0435\u0432<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e 0.3 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f KotlinDL!<\/p>\n<p>\u0412\u0430\u0441 \u0436\u0434\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u043e\u0432\u044b\u0445 \u0444\u0438\u0447: \u043d\u043e\u0432\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 ModelHub (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u043b\u0438\u0446), \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043e\u0431\u0443\u0447\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 Keras \u0438 PyTorch \u0432 ONNX, \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 API \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u043e\u0432\u044b\u0445 \u0441\u043b\u043e\u0435\u0432, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u0438\u0431\u044c\u044e\u0442\u043e\u0440\u0430\u043c\u0438. \u0422\u0430\u043a\u0436\u0435 KotlinDL \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 <a href=\"https:\/\/search.maven.org\/artifact\/org.jetbrains.kotlinx\/kotlin-deeplearning-api\"><u>Maven Central<\/u><\/a>.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043a\u043e\u0441\u043d\u0435\u043c\u0441\u044f \u0441\u0430\u043c\u044b\u0445 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0440\u0435\u043b\u0438\u0437\u0430 0.3. \u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e <a href=\"https:\/\/github.com\/JetBrains\/KotlinDL\/blob\/master\/CHANGELOG.md\"><u>\u0441\u0441\u044b\u043b\u043a\u0435<\/u><\/a>.<\/p>\n<h2>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f ONNX <\/h2>\n<p>\u0412 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0433\u043e\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u0440\u043e\u0441\u0438\u043b\u0438 \u043d\u0430\u0441 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u043c\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 ONNX.<\/p>\n<p>Open Neural Network Exchange (ONNX) \u2014 \u044d\u0442\u043e \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 AI \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c. \u041e\u043d \u0437\u0430\u0434\u0430\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0433\u0440\u0430\u0444\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u0430\u043a\u0436\u0435 \u044d\u0442\u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 TensorFlow \u0438 PyTorch.<\/p>\n<p>\u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <a href=\"https:\/\/github.com\/microsoft\/onnxruntime\/tree\/master\/java\"><u>ONNX Runtime Java API<\/u><\/a> \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 `.onnx`. \u041e \u0442\u043e\u043c, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0435 API \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 <a href=\"https:\/\/onnxruntime.ai\/docs\/api\/java\/index.html\"><u>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/u><\/a>.<\/p>\n<p>\u0412 KotlinDL \u0435\u0441\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c `onnx` \u2014\u00a0\u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 ONNX. \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c ONNX \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e <a href=\"https:\/\/search.maven.org\/artifact\/org.jetbrains.kotlinx\/kotlin-deeplearning-onnx\/0.3.0-alpha-3\/jar\"><u>\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c <\/u><\/a>\u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p>\u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u044b \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 ONNX. \u0415\u0441\u043b\u0438 \u0432\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c LeNet-5 (\u043e\u0434\u043d\u0443 \u0438\u0437 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 ModelHub), \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0435\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"kotlin\">val (train, test) = mnist()  val modelHub = ONNXModelHub(cacheDirectory = File(\"cache\/pretrainedModels\"))  val modelType = ONNXModels.CV.Lenet val model = modelHub.loadModel(modelType)  model.use {    val prediction = it.predict(train.getX(0))     println(\"Predicted Label is: $prediction\")    println(\"Correct Label is: \" + train.getY(0)) }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 ONNX, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>OnnxInferenceModel<\/code>: <\/p>\n<pre><code class=\"kotlin\">OnnxInferenceModel.load(PATH_TO_MODEL).use {     val prediction = it.predict(...) }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0432\u044b\u0445\u043e\u0434, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439, \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0435\u043d\u0437\u043e\u0440\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 YOLOv4 \u0438\u043b\u0438 SSD), \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>predictRaw<\/code> :<\/p>\n<pre><code class=\"kotlin\">val yhat = it.predictRaw(inputData)<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c\u0443 \u0432\u044b\u0445\u043e\u0434\u0443 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<p>\u041d\u0430\u0439\u0442\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0432 <code>ONNXModelHub<\/code> \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e: \u043d\u0430\u0447\u043d\u0438\u0442\u0435 \u043f\u043e\u0438\u0441\u043a \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f <code>ONNXModels<\/code>, \u0441\u043f\u0443\u0441\u043a\u0430\u0439\u0442\u0435\u0441\u044c \u0433\u043b\u0443\u0431\u0436\u0435 \u0432 CV \u0438\u043b\u0438 ObjectDetection, \u0430 \u0437\u0430\u0442\u0435\u043c \u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u043c\u043e\u0434\u0435\u043b\u044f\u043c. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0443 \u0432\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u2014\u00a0\u043e\u043d\u0430 \u0438 \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u043b\u0438 \u0435\u0435 \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, EfficientNet \u2014\u00a0\u043e\u0434\u043d\u0430 \u0438\u0437 \u043b\u0443\u0447\u0448\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043f\u043e \u0438\u0442\u043e\u0433\u0430\u043c 2020 \u0433\u043e\u0434\u0430 \u2014 \u0438\u043c\u0435\u0435\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440: <code>ONNXModels.CV.EfficientNet4Lite<\/code>.<\/p>\n<h2>\u0414\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 (fine-tuning) ONNX-\u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/h2>\n<p>\u0414\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u044b \u043d\u0430 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u043e \u043a\u0430\u043a \u043d\u0430\u0441\u0447\u0435\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438\u0445 \u043f\u043e\u0434 \u043d\u0430\u0448\u0438 \u0437\u0430\u0434\u0430\u0447\u0438?<\/p>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, ONNX Java API \u043d\u0435 \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0443\u0447\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438. \u041d\u043e \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0432\u0441\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0446\u0435\u043b\u0438\u043a\u043e\u043c, \u0430 \u043b\u0438\u0448\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b.<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0437\u0430\u0434\u0430\u0447\u0438 Transfer Learning \u0434\u043b\u044f ResNet-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043c\u043e\u0440\u043e\u0437\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u043b\u043e\u0438, \u043a\u0440\u043e\u043c\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u0445\u043d\u0438\u0445 \u0441\u043b\u043e\u0435\u0432 (\u043f\u043e\u043b\u043d\u043e\u0441\u0432\u044f\u0437\u043d\u044b\u0445 \u0441\u043b\u043e\u0435\u0432, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0432\u044b\u0445\u043e\u0434 \u043c\u043e\u0434\u0435\u043b\u0438) \u043d\u0430 \u043d\u043e\u0432\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0412\u0435\u0440\u0445\u043d\u0438\u0435 \u0441\u043b\u043e\u0438 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c, \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u0438, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u0438\u0437 \u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u043b\u043e\u0435\u0432. \u0417\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0441\u043b\u043e\u0438 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430 \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u043b\u043d\u043e\u0441\u0432\u044f\u0437\u043d\u044b\u0445 \u0441\u043b\u043e\u0435\u0432.<\/p>\n<p>\u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0432 \u043d\u0430\u0448\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u043e\u0434\u0435\u043b\u044c ONNX \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 (\u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430) \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u043a \u043d\u0435\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 Sequential \u0438\u043b\u0438 Functional API.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0433\u0440\u043e\u043c\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0432 Keras \u0438\u043b\u0438 PyTorch, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0434\u043e\u043e\u0431\u0443\u0447\u0438\u0442\u044c \u0432 KotlinDL. \u0412\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u0440\u0435\u0437\u0430\u0442\u044c \u043e\u0442 \u043d\u0435\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0441\u043b\u043e\u0438, \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 ONNX, \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432 KotlinDL \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430 \u0447\u0435\u0440\u0435\u0437 ONNXModelPreprocessor, \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0435 \u0441\u043b\u043e\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e API KotlinDL \u0438 \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b87\/66d\/b0e\/b8766db0e4c2c1e42fe4afa6f73274b8.png\" alt=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 1. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u0441\u0435\u0442\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 ONNX.\" title=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 1. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u0441\u0435\u0442\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 ONNX.\" width=\"402\" height=\"822\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b87\/66d\/b0e\/b8766db0e4c2c1e42fe4afa6f73274b8.png\"\/><figcaption>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 1. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u0441\u0435\u0442\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 ONNX.<\/figcaption><\/figure>\n<p>\u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a \u043c\u044b \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c ResNet50 \u0438\u0437 <code>ONNXModelHub<\/code> \u0438 \u0434\u043e\u043e\u0431\u0443\u0447\u0430\u0435\u043c \u0435\u0435 \u043d\u0430 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 Dogs-vs-Cats, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043c\u043e\u0433\u043b\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a\u043e\u0448\u0435\u043a \u0438 \u0441\u043e\u0431\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">val modelHub = ONNXModelHub(    cacheDirectory = File(\"cache\/pretrainedModels\") ) val model = modelHub.loadModel(ONNXModels.CV.ResNet50noTopCustom)  val dogsVsCatsDatasetPath = dogsCatsDatasetPath()  model.use {    it.reshape(64, 64, 3)     val preprocessing: Preprocessing = preprocess {        load {            pathToData = File(dogsVsCatsDatasetPath)            imageShape = ImageShape(channels = NUM_CHANNELS)            colorMode = ColorOrder.BGR            labelGenerator = FromFolders(mapping = mapOf(\"cat\" to 0, \"dog\" to 1))        }        transformImage {            resize {                outputHeight = IMAGE_SIZE.toInt()                outputWidth = IMAGE_SIZE.toInt()                interpolation = InterpolationType.BILINEAR            }        }        transformTensor {            sharpen {                modelType = TFModels.CV.ResNet50            }            onnx {                onnxModel = model            }        }    }     val dataset = OnFlyImageDataset.create(preprocessing).shuffle()    val (train, test) = dataset.split(TRAIN_TEST_SPLIT_RATIO)     topModel.use {        topModel.compile(            optimizer = Adam(),            loss = Losses.SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS,            metric = Metrics.ACCURACY        )         topModel.fit(dataset = train, epochs = EPOCHS, batchSize = TRAINING_BATCH_SIZE)         val accuracy = topModel.evaluate(dataset = test, batchSize = TEST_BATCH_SIZE).metrics[Metrics.ACCURACY]         println(\"Accuracy: $accuracy\")    } }<\/code><\/pre>\n<p><code>topModel<\/code> \u2014 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0431\u0443\u0447\u0438\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<pre><code class=\"kotlin\">\/** * This is a simple model based on Dense layers only. *\/ private val topModel = Sequential.of(    Input(2, 2, 2048),    GlobalAvgPool2D(),    Dense(2, Activations.Linear, kernelInitializer = HeNormal(12L), biasInitializer = Zeros()) )<\/code><\/pre>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e <a href=\"https:\/\/github.com\/JetBrains\/KotlinDL\/blob\/master\/examples\/src\/main\/kotlin\/examples\/onnx\/cv\/custom\/additionalTrainingWithTensorFlow.kt\"><u>\u0441\u0441\u044b\u043b\u043a\u0435<\/u><\/a>.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 API \u0434\u043b\u044f \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u044f \u0441\u043b\u043e\u0435\u0432 \u0438 \u0432\u044b\u043a\u043e\u0440\u0447\u0435\u0432\u044b\u0432\u0430\u043d\u0438\u044f \u0432\u0435\u0441\u043e\u0432 \u0438\u0437 \u043c\u043e\u0434\u0435\u043b\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0439 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 ONNX, \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0434 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u043e\u043c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 ONNX. \u0414\u0430, \u044d\u0442\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 Python. \u041d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u0439\u0442\u0435: \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0435\u043b\u0438\u0437\u0435 \u043c\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 ModelHub \u043c\u043d\u043e\u0433\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438\u0437 PyTorch \u0438 Keras \u0441 \u0443\u0436\u0435 \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c\u0438 \u0441\u043b\u043e\u044f\u043c\u0438.<\/p>\n<h2>ModelHub: \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438\u0437 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432 DenseNet, Inception \u0438 NasNet<\/h2>\n<p>\u0412 KotlinDL 0.2 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043d\u0430\u0437\u0432\u0430\u043b\u0438 \u0435\u0433\u043e ModelZoo, \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043b\u0438 \u0432 ModelHub.<\/p>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 <code>ModelHub<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u044b \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a <a href=\"https:\/\/www.image-net.org\/\"><u>ImageNet<\/u><\/a> \u0438 <a href=\"https:\/\/cocodataset.org\/#home\"><u>COCO<\/u><\/a><\/p>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0435\u0441\u0442\u044c \u0434\u0432\u0430 <code>ModelHub<\/code>, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438: \u0431\u0430\u0437\u043e\u0432\u044b\u0439 <code>TFModelHub<\/code>, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 `api`, \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 <code>ONNXModelHub<\/code>, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435` onnx`.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/db4\/45c\/334\/db445c3343b691a8376d4f8d09cc0487.png\" alt=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 2. \u0418\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 ModelHub.\" title=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 2. \u0418\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 ModelHub.\" width=\"912\" height=\"589\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/db4\/45c\/334\/db445c3343b691a8376d4f8d09cc0487.png\"\/><figcaption>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 2. \u0418\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 ModelHub.<\/figcaption><\/figure>\n<p>TFModelHub \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u043e\u0434\u0435\u043b\u0438:<\/p>\n<ul>\n<li>\n<p>VGG\u201916<\/p>\n<\/li>\n<li>\n<p>VGG\u201919<\/p>\n<\/li>\n<li>\n<p>ResNet18<\/p>\n<\/li>\n<li>\n<p>ResNet34<\/p>\n<\/li>\n<li>\n<p>ResNet50<\/p>\n<\/li>\n<li>\n<p>ResNet101<\/p>\n<\/li>\n<li>\n<p>ResNet152<\/p>\n<\/li>\n<li>\n<p>ResNet50v2<\/p>\n<\/li>\n<li>\n<p>ResNet101v2<\/p>\n<\/li>\n<li>\n<p>ResNet152v2<\/p>\n<\/li>\n<li>\n<p>MobileNet<\/p>\n<\/li>\n<li>\n<p>MobileNetv2<\/p>\n<\/li>\n<li>\n<p>Inception<\/p>\n<\/li>\n<li>\n<p>Xception<\/p>\n<\/li>\n<li>\n<p>DenseNet121<\/p>\n<\/li>\n<li>\n<p>DenseNet169<\/p>\n<\/li>\n<li>\n<p>DenseNet201<\/p>\n<\/li>\n<li>\n<p>NASNetMobile<\/p>\n<\/li>\n<li>\n<p>NASNetLarge<\/p>\n<\/li>\n<\/ul>\n<p>ONNXModelHub \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u043e\u0434\u0435\u043b\u0438:<\/p>\n<p><strong>CV<\/strong><\/p>\n<ul>\n<li>\n<p>Lenet<\/p>\n<\/li>\n<li>\n<p>ResNet18<\/p>\n<\/li>\n<li>\n<p>ResNet34<\/p>\n<\/li>\n<li>\n<p>ResNet50<\/p>\n<\/li>\n<li>\n<p>ResNet101<\/p>\n<\/li>\n<li>\n<p>ResNet152<\/p>\n<\/li>\n<li>\n<p>ResNet50v2<\/p>\n<\/li>\n<li>\n<p>ResNet101v2<\/p>\n<\/li>\n<li>\n<p>ResNet152v2<\/p>\n<\/li>\n<li>\n<p>EfficientNet4Lite<\/p>\n<\/li>\n<\/ul>\n<p><strong>ObjectDetection<\/strong><\/p>\n<ul>\n<li>\n<p>SSD<\/p>\n<\/li>\n<\/ul>\n<p><strong>FaceAlignment<\/strong><\/p>\n<ul>\n<li>\n<p>Fan2d106<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 <code>TFModelHub<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438 \u0432\u0435\u0441\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u0430\u0441\u044c \u043f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0430 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 <a href=\"http:\/\/www.image-net.org\/\"><u>ImageNet<\/u><\/a>. \u0415\u0441\u043b\u0438 \u0437\u0430\u0431\u044b\u0442\u044c \u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043a \u0432\u0445\u043e\u0434\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u043c\u043e\u0434\u0435\u043b\u0438, \u0442\u043e \u0432\u044b\u0445\u043e\u0434 \u0432\u0430\u0441 \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e \u0443\u0434\u0438\u0432\u0438\u0442.<\/p>\n<p>\u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c ResNet50 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"kotlin\">val modelHub = TFModelHub(cacheDirectory = File(\"cache\/pretrainedModels\")) val model = modelHub.loadModel(TFModels.CV.ResNet50)  val imageNetClassLabels = modelHub.loadClassLabels()  model.use {     val hdfFile = modelHub.loadWeights(TFModels.CV.ResNet50)     it.loadWeights(hdfFile) \u2026 }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0432\u0435\u0441\u0430 \u043c\u043e\u0434\u0435\u043b\u0438. \u0414\u0430\u043b\u0435\u0435 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 KotlinDL.<\/p>\n<blockquote>\n<p>\u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433 \u043d\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 ModelHub \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0441\u0432\u043e\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430 <code>preprocessInput<\/code>:<\/p>\n<\/blockquote>\n<pre><code class=\"kotlin\">val inputData = modelType.preprocessInput(...) val res = it.predict(inputData)<\/code><\/pre>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 ResNet\u201950 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043d\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u044d\u0442\u043e\u043c <a href=\"https:\/\/github.com\/JetBrains\/KotlinDL\/blob\/master\/docs\/transfer_learning_functional.md\"><u>\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435<\/u><\/a>.<\/p>\n<blockquote>\n<p>\u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 ONNX \u0432\u0430\u043c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0432\u0435\u0441\u0430 (\u0441\u043c. \u0440\u0430\u0437\u0434\u0435\u043b \u00ab\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f ONNX\u00bb \u0432\u044b\u0448\u0435).<\/p>\n<\/blockquote>\n<h2>\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 \u043c\u043e\u0434\u0435\u043b\u0438 SSD<\/h2>\n<p>\u041f\u0440\u043e\u0448\u043b\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f ModelHub \u0432\u043a\u043b\u044e\u0447\u0430\u043b\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 (Image Recognition). \u041c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438. \u0412 \u044d\u0442\u043e\u043c \u0440\u0435\u043b\u0438\u0437\u0435 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c <a href=\"https:\/\/arxiv.org\/pdf\/1512.02325.pdf\"><u>Single Shot MultiBox Detector (SSD)<\/u><\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445 (\u0437\u0430\u0434\u0430\u0447\u0430 Object Detection).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e2f\/6a8\/584\/e2f6a85849e0cc595d1f46b1be3f7a0a.png\" alt=\"\u0420\u0438\u0443\u043d\u043e\u043a 3. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0432\u0435\u0440\u0442\u043e\u0447\u043d\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0441 \u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 SSD\" title=\"\u0420\u0438\u0443\u043d\u043e\u043a 3. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0432\u0435\u0440\u0442\u043e\u0447\u043d\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0441 \u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 SSD\" width=\"901\" height=\"271\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e2f\/6a8\/584\/e2f6a85849e0cc595d1f46b1be3f7a0a.png\"\/><figcaption>\u0420\u0438\u0443\u043d\u043e\u043a 3. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0432\u0435\u0440\u0442\u043e\u0447\u043d\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0441 \u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 SSD<\/figcaption><\/figure>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 Object Detection \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438. \u041f\u0440\u0438\u0447\u0435\u043c \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c \u0444\u0430\u043a\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0442\u0430\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u043e \u0435\u0449\u0435 \u0438 \u0438\u0445 \u0433\u0440\u0430\u043d\u0438\u0446\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0432\u043f\u0438\u0441\u0430\u043d).<\/p>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c SSD \u043e\u0431\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 <a href=\"https:\/\/paperswithcode.com\/dataset\/coco\"><u>COCO<\/u><\/a>, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u043c \u0438\u0437 328 000 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0437\u0430\u0434\u0430\u043d\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0435 \u0440\u0430\u043c\u043a\u0438 \u0438 \u043c\u0430\u0441\u043a\u0438 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0434\u043d\u0430 \u0438\u0437 80 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u00ab\u0447\u0435\u043b\u043e\u0432\u0435\u043a\u00bb, \u00ab\u043c\u0430\u0448\u0438\u043d\u0430\u00bb, \u00ab\u0441\u0432\u0435\u0442\u043e\u0444\u043e\u0440\u00bb, \u00ab\u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u00bb). \u0422\u0430\u043a\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0438\u0445 \u0433\u0440\u0430\u043d\u0438\u0446 \u043f\u0440\u0438 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 API, \u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0434\u0435\u0442\u0430\u043b\u0438 \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430 \u0438 \u043f\u043e\u0441\u0442\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<pre><code class=\"kotlin\">val modelHub =    ONNXModelHub(cacheDirectory = File(\"cache\/pretrainedModels\"))     val model = ONNXModels.ObjectDetection.SSD.pretrainedModel(modelHub)  model.use { detectionModel ->    val detectedObjects =        detectionModel.detectObjects(imageFile = File (...), topK = 50)     detectedObjects.forEach {        println(\"Found ${it.classLabel} with probability ${it.probability}\")    } }<\/code><\/pre>\n<p>\u041c\u044b \u043f\u0440\u043e\u0433\u043d\u0430\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0448 \u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0432\u0438\u0434\u0435\u043e \u0441 \u043a\u0430\u043c\u0435\u0440\u044b \u043d\u0430 \u0443\u043b\u0438\u0447\u043d\u043e\u043c \u043f\u0435\u0440\u0435\u043a\u0440\u0435\u0441\u0442\u043a\u0435, \u0432\u044b\u0434\u0435\u043b\u0438\u0432 \u043a\u0440\u0430\u0441\u043d\u044b\u043c \u043b\u044e\u0434\u0435\u0439, \u0441\u0438\u043d\u0438\u043c \u2014 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u044b, \u0437\u0435\u043b\u0435\u043d\u044b\u043c \u2014 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ji\/vi\/mw\/jivimw7zgisjlbk1wfzvvobxtsq.gif\" alt=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 4. \u0420\u0430\u0431\u043e\u0442\u0430 ObjectDetection API\" title=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 4. \u0420\u0430\u0431\u043e\u0442\u0430 ObjectDetection API\" width=\"800\" height=\"400\" data-src=\"https:\/\/habrastorage.org\/webt\/ji\/vi\/mw\/jivimw7zgisjlbk1wfzvvobxtsq.gif\"\/><figcaption>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 4. \u0420\u0430\u0431\u043e\u0442\u0430 ObjectDetection API<\/figcaption><\/figure>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c YOLOv4 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0432 <code>ONNXModelHub<\/code>. \u041e\u0434\u043d\u0430\u043a\u043e \u043c\u044b \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 <a href=\"https:\/\/github.com\/onnx\/models\/tree\/master\/vision\/object_detection_segmentation\/yolov4#postprocessing-steps\"><u>\u043f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0432\u044b\u0432\u043e\u0434\u0430 YOLOv4<\/u><\/a>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <a href=\"https:\/\/github.com\/Kotlin\/multik\"><u>Multik<\/u><\/a> (\u0430\u043d\u0430\u043b\u043e\u0433 NumPy \u0434\u043b\u044f Kotlin) \u043d\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u044d\u0442\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 (\u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438), \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0442\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u0438\u0431\u044c\u044e\u0442\u043e\u0440\u043e\u043c \u0438 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e API \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0448\u0438\u0440\u043e\u043a\u0438\u043c \u043a\u0440\u0443\u0433\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0430 Kotlin (\u0434\u0430 \u0438 \u043d\u0430 Java \u0442\u043e\u0436\u0435).<\/p>\n<p>\u041f\u0420\u0418\u041c\u0415\u0427\u0410\u041d\u0418\u0415: \u0432\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 API \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 ONNX-\u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043c\u0435\u0442\u043e\u0434 <code>predictRaw<\/code> \u2014\u00a0\u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0440\u0443\u0447\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u043d\u043e \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u044d\u0442\u043e \u0443\u0434\u0430\u0441\u0442\u0441\u044f, \u0432\u0430\u0448 \u043f\u0443\u043b\u0440\u0435\u043a\u0432\u0435\u0441\u0442 \u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0432\u043a\u043b\u0430\u0434\u043e\u043c \u0432 KotlinDL.<\/p>\n<h2>\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0435 API \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 <\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \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, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u0435 API \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043c\u044b \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c API, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043a\u0440\u043e\u0435\u0442 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044e \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u0438, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438, \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 ModelHub.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0442\u0438\u043f\u0430 <code>ImageRecognitionModel<\/code>. \u041c\u043e\u0434\u0435\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043d\u0435 \u0434\u043e\u043e\u0431\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u2014 \u043e\u043d\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u043b\u0430\u044e\u0442 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u044b. \u041d\u043e \u043f\u043b\u044e\u0441 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441 \u043d\u0438\u043c\u0438 \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<pre><code class=\"kotlin\">val modelHub =    TFModelHub(cacheDirectory = File(\"cache\/pretrainedModels\"))  val model = modelHub[TFModels.CV.ResNet50]<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u043e\u0442 \u043c\u0438\u043b\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0441 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u043a\u043e\u0431\u043e\u0447\u043a\u0430\u043c\u0438 \u2014 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0440\u0435\u0434\u043e\u0431\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u043c\u043e\u0434\u0435\u043b\u044f\u043c.<\/p>\n<pre><code class=\"kotlin\">model.use {    for (i in 1..8) {        val imageFile = getFileFromResource(\"datasets\/vgg\/image$i.jpg\")         val recognizedObject = it.predictObject(imageFile = imageFile)        println(recognizedObject)               val top5 = it.predictTopKObjects(imageFile = imageFile, topK = 5)        println(top5.toString())    } }<\/code><\/pre>\n<p>\u0423 \u043a\u043b\u0430\u0441\u0441\u0430 <code>ImageRecognitionModel<\/code> \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0444\u0430\u0439\u043b\u044b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043c\u0435\u0442\u043a\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435.<\/p>\n<p>\u042d\u0442\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 API \u2014\u00a0\u043e\u043d \u0434\u043b\u044f \u0445\u0430\u0440\u0434\u043a\u043e\u0440\u043d\u044b\u0445 \u0431\u044d\u043a\u0435\u043d\u0434-\u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043e\u0432. \u041f\u043e \u0441\u0443\u0442\u0438, \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0447\u0435\u0440\u043d\u044b\u0439 \u044f\u0449\u0438\u043a \u0441 \u0432\u0445\u043e\u0434\u043e\u043c \u0438 \u0432\u044b\u0445\u043e\u0434\u043e\u043c. \u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u044d\u0442\u043e\u0442 API \u0438 \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043d\u0430\u043c \u043e \u0441\u0432\u043e\u0438\u0445 \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u044f\u0445.<\/p>\n<h2>\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0437\u0432\u0443\u043a\u0430 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b SoundNet <\/h2>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 KotlinDL \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0432\u043e\u0438 \u043f\u0435\u0440\u0432\u044b\u0435 \u0448\u0430\u0433\u0438 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0437\u0432\u0443\u043a\u043e\u043c. \u0412 \u044d\u0442\u043e\u043c \u0440\u0435\u043b\u0438\u0437\u0435 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u043e\u0435\u0432, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438, \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 SoundNet:\u00a0 Conv1D, MaxPooling1D, Cropping1D, UpSampling1D \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u043b\u043e\u0438 \u0441 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u043c \u00ab1D\u00bb \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0438.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043c\u043e\u0434\u0435\u043b\u0438 SoundNet:<\/p>\n<pre><code class=\"kotlin\">val soundNet = Sequential.of(    Input(        FSDD_SOUND_DATA_SIZE,        NUM_CHANNELS    ),    *soundBlock(        filters = 4,        kernelSize = 8,        poolStride = 2    ),    *soundBlock(        filters = 4,        kernelSize = 16,        poolStride = 4    ),    *soundBlock(        filters = 8,        kernelSize = 16,        poolStride = 4    ),    *soundBlock(        filters = 8,        kernelSize = 16,        poolStride = 4    ),    Flatten(),    Dense(        outputSize = 1024,        activation = Activations.Relu,        kernelInitializer = HeNormal(SEED),        biasInitializer = HeNormal(SEED)    ),    Dense(        outputSize = NUMBER_OF_CLASSES,        activation = Activations.Linear,        kernelInitializer = HeNormal(SEED),        biasInitializer = HeNormal(SEED)    ) )<\/code><\/pre>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438, \u044d\u0442\u043e \u0441\u0432\u0435\u0440\u0442\u043e\u0447\u043d\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0435 \u0441\u043b\u043e\u0438 \u0434\u043b\u044f \u0441\u0432\u0435\u0440\u0442\u043e\u043a \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0437\u0432\u0443\u043a\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 FSDD \u044d\u0442\u0430 \u0441\u0435\u0442\u044c \u0434\u043e\u0441\u0442\u0438\u0433\u043b\u0430 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 ~55% \u0437\u0430 10 \u044d\u043f\u043e\u0445 \u0438 ~85% \u2014\u00a0\u0437\u0430 100 \u044d\u043f\u043e\u0445.<\/p>\n<p>\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043a\u043e\u0434 SoundBlock. \u042d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0438\u0437 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0435\u0432 Conv1D \u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f MaxPool1D:<\/p>\n<pre><code class=\"kotlin\">fun soundBlock(filters: Long, kernelSize: Long, poolStride: Long): Array&lt;Layer> =    arrayOf(        Conv1D(            filters = filters,            kernelSize = kernelSize,            strides = longArrayOf(1, 1, 1),            activation = Activations.Relu,            kernelInitializer = HeNormal(SEED),            biasInitializer = HeNormal(SEED),            padding = ConvPadding.SAME        ),        Conv1D(            filters = filters,            kernelSize = kernelSize,            strides = longArrayOf(1, 1, 1),            activation = Activations.Relu,            kernelInitializer = HeNormal(SEED),            biasInitializer = HeNormal(SEED),            padding = ConvPadding.SAME        ),        MaxPool1D(            poolSize = longArrayOf(1, poolStride, 1),            strides = longArrayOf(1, poolStride, 1),            padding = ConvPadding.SAME        )    )<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u0430 \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438, \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 <a href=\"https:\/\/github.com\/Jakobovski\/free-spoken-digit-dataset\"><u>Free Spoken Digits Dataset <\/u><\/a>(FSDD) \u0438 \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c. FSDD \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0430\u0443\u0434\u0438\u043e\/\u0440\u0435\u0447\u0435\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043f\u0440\u043e\u0438\u0437\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0445 \u0446\u0438\u0444\u0440, \u0432 \u0444\u0430\u0439\u043b\u0430\u0445 .wav \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 8 \u043a\u0413\u0446.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/0ad\/825\/552\/0ad82555278990a5667f25a6fafe8444.jpg\" alt=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 5. \u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 .wav (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0430\u044f \u0438\u0437 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 FSDD).\" title=\"\u0420\u0438\u0441\u0443\u043d\u043e\u043a 5. \u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 .wav (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0430\u044f \u0438\u0437 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 FSDD).\" width=\"651\" height=\"331\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0ad\/825\/552\/0ad82555278990a5667f25a6fafe8444.jpg\" data-blurred=\"true\"\/><figcaption>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 5. \u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 .wav (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0430\u044f \u0438\u0437 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 FSDD).<\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0446\u0438\u0444\u0440\u044b \u043f\u043e \u0430\u0443\u0434\u0438\u043e\u0437\u0430\u043f\u0438\u0441\u044f\u043c. \u041c\u043e\u0436\u043d\u043e \u0434\u0430\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0440\u0435\u043d\u0430\u0436\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0446\u0438\u0444\u0440 \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435. <\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 SoundNet \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/JetBrains\/KotlinDL\/blob\/release_0.3\/examples\/src\/main\/kotlin\/examples\/cnn\/fsdd\/SoundNet.kt\"><u>\u0442\u0443\u0442<\/u><\/a>.<\/p>\n<h2>+23 \u0441\u043b\u043e\u044f, +6 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0438 +2 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430<\/h2>\n<p>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u0442\u0440\u0438\u0431\u044c\u044e\u0442\u043e\u0440\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432 KotlinDL \u043d\u043e\u0432\u044b\u0435 \u0441\u043b\u043e\u0438 \u0441 \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u043e\u0439. \u042d\u0442\u0438 \u0441\u043b\u043e\u0438 \u0434\u0430\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438, \u0437\u0432\u0443\u043a, \u0432\u0438\u0434\u0435\u043e \u0438\u043b\u0438 3D-\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>Softmax activation layer (<a href=\"https:\/\/github.com\/d-lowl\"><u>D. Lowl<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>LeakyReLU activation layer <a href=\"https:\/\/github.com\/mkaze\"><u>Masoud Kazemi<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>PReLU activate layer (<a href=\"https:\/\/github.com\/mkaze\"><u>Masoud Kazemi<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>ELU activation layer (<a href=\"https:\/\/github.com\/avan1235\"><u>Maciej Procyk<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>ThresholdedReLU activation layer (<a href=\"https:\/\/github.com\/mkaze\"><u>Masoud Kazemi<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>Conv1D layer (<a href=\"https:\/\/github.com\/avan1235\"><u>Maciej Procyk<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>MaxPooling1D layer (<a href=\"https:\/\/github.com\/mkaze\"><u>Masoud Kazemi<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>AveragePooling1D layer (<a href=\"https:\/\/github.com\/mkaze\"><u>Masoud Kazemi<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>GlobalMaxPooling1D layer (<a href=\"https:\/\/github.com\/mkaze\"><u>Masoud Kazemi<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>GlobalAveragePooling1D layer (<a href=\"https:\/\/github.com\/therealansh\"><u>Ansh Tyagi<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>Conv3D layer (<a href=\"https:\/\/github.com\/avan1235\"><u>Maciej Procyk<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>MaxPooling3D layer (<a href=\"https:\/\/github.com\/therealansh\"><u>Ansh Tyagi<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>AveragePooling3D layer (<a href=\"https:\/\/github.com\/mkaze\"><u>Masoud Kazemi<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>GlobalAveragePooling3D layer (<a href=\"https:\/\/github.com\/therealansh\"><u>Ansh Tyagi<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>GlobalMaxPool2D layer (<a href=\"https:\/\/github.com\/mkaze\"><u>Masoud Kazemi<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>GlobalMaxPool3D layer (<a href=\"https:\/\/github.com\/mkaze\"><u>Masoud Kazemi<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>Cropping1D and Cropping3D layers (<a href=\"https:\/\/github.com\/mkaze\"><u>Masoud Kazemi<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>Permute layer (<a href=\"https:\/\/github.com\/therealansh\"><u>Ansh Tyagi<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>RepeatVector layer (<a href=\"https:\/\/github.com\/dosier\"><u>Stan van der Bend<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>UpSampling1D, UpSampling2D, and UpSampling3D layers (<a href=\"https:\/\/github.com\/mkaze\"><u>Masoud Kazemi<\/u><\/a>)<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u043e\u0432\u044b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b:<\/p>\n<ul>\n<li>\n<p>Identity initializer (<a href=\"https:\/\/github.com\/hbrammer\"><u>Hauke Brammer<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>Orthogonal initializer (<a href=\"https:\/\/github.com\/therealansh\"><u>Ansh Tyagi<\/u><\/a>)<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>Gelu activation function (<a href=\"https:\/\/github.com\/therealansh\"><u>Ansh Tyagi<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>HardShrink activation function (<a href=\"https:\/\/github.com\/therealansh\"><u>Ansh Tyagi<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>LiSHT activation function (<a href=\"https:\/\/github.com\/knok16\"><u>Veniamin Viflyantsev<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>Mish activation function (<a href=\"https:\/\/github.com\/digantamisra98\"><u>Xa9aX \u30c4<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>Snake activation function (<a href=\"https:\/\/github.com\/cagriyildirimR\"><u>cagriyildirimR<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>TanhShrink activation function(<a href=\"https:\/\/github.com\/femialaka\"><u>Femi Alaka<\/u><\/a>)<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043d\u0435 \u0432\u0445\u043e\u0434\u044f\u0442 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0430\u043a\u0435\u0442 TensorFlow. \u041c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u0432 KotlinDL, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0438 \u0447\u0430\u0441\u0442\u043e \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0432 \u0440\u044f\u0434\u0435 \u043d\u043e\u0432\u044b\u0445 \u043d\u0430\u0443\u0447\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0440\u0435\u043b\u0438\u0437\u0430\u0445 \u043c\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u043f\u0430\u0440\u0438\u0442\u0435\u0442\u0430 \u043f\u043e \u0441\u043b\u043e\u044f\u043c \u0441 <a href=\"https:\/\/keras.io\/api\/layers\/\"><u>\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c Keras<\/u><\/a> \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0439\u0442\u0438 \u0434\u0430\u043b\u044c\u0448\u0435, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0441\u043b\u043e\u0435\u0432 \u0438\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 SOTA-\u043c\u043e\u0434\u0435\u043b\u0435\u0439.<\/p>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0434\u044b \u0432\u0430\u0448\u0438\u043c \u043f\u0443\u043b\u0440\u0435\u043a\u0432\u0435\u0441\u0442\u0430\u043c \u043d\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u0441\u043b\u043e\u0435\u0432, \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438, \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 (callbacks) \u0438\u043b\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432 \u0438\u0437 \u043d\u043e\u0432\u044b\u0445\/\u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u043d\u0430\u0443\u0447\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439!<\/p>\n<h2>\u041a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c KotlinDL \u0432 \u043f\u0440\u043e\u0435\u043a\u0442<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c KotlinDL \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 ONNX \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e), \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u0444\u0430\u0439\u043b <code>build.gradle<\/code>:<\/p>\n<pre><code>repositories {     mavenCentral() }  dependencies {     implementation 'org.jetbrains.kotlinx:kotlin-deeplearning-api:0.3.0'     implementation 'org.jetbrains.kotlinx:kotlin-deeplearning-onnx:0.3.0'     implementation 'org.jetbrains.kotlinx:kotlin-deeplearning-visualization:0.3.0' }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 ONNX \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<pre><code>dependencies {     implementation 'org.jetbrains.kotlinx:kotlin-deeplearning-api:0.3.0' }<\/code><\/pre>\n<p>KotlinDL \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 Java-\u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432 \u043d\u0438\u0445 \u043d\u0435\u0442 \u043d\u0438 \u043a\u0430\u043f\u043b\u0438 Kotlin. <a href=\"https:\/\/github.com\/JetBrains\/KotlinDL\/blob\/release_0.3\/examples\/src\/main\/java\/LeNetClassic.java\"><u>\u0417\u0434\u0435\u0441\u044c<\/u><\/a> \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u0432\u0435\u0440\u0442\u043e\u0447\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u043d\u0430 Java.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 Java API, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043d\u0430\u043c \u043e\u0431 \u044d\u0442\u043e\u043c \u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 PR.<\/p>\n<h2>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h2>\n<p>\u041c\u044b \u043d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u043d\u0430\u0448\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0438 \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 KotlinDL.\u00a0<\/p>\n<p>\u0425\u043e\u0442\u0438\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0435? \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 <a href=\"https:\/\/github.com\/JetBrains\/KotlinDL\/blob\/master\/README.md\"><u>Readme<\/u><\/a> \u0438\u043b\u0438 \u0441\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 <a href=\"https:\/\/github.com\/JetBrains\/KotlinDL\"><u>GitHub<\/u><\/a>. \u0410 \u044d\u0442\u043e\u0442 <a href=\"https:\/\/github.com\/JetBrains\/KotlinDL\/blob\/master\/docs\/quick_start_guide.md\"><u>\u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b<\/u><\/a> \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0430\u0448\u0443 \u043f\u0435\u0440\u0432\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043d\u0430 Kotlin.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d KotlinDL, \u043a\u0430\u043a \u043e\u043d \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0438 \u0432 \u043a\u0430\u043a\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u0442\u0430\u043a \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 Keras, \u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043b\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 PyTorch, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0441\u0432\u0435\u0436\u0435\u0435 <a href=\"https:\/\/www.youtube.com\/watch?v=jCFZc97_XQU\"><u>\u0432\u0438\u0434\u0435\u043e<\/u><\/a> \u043e\u0442 \u0410\u043b\u0435\u043a\u0441\u0435\u044f \u0417\u0438\u043d\u043e\u0432\u044c\u0435\u0432\u0430.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u0436\u0434\u0435\u043c \u0432\u0430\u0441 \u0432 Slack-\u043a\u0430\u043d\u0430\u043b\u0435 <a href=\"https:\/\/app.slack.com\/client\/T09229ZC6\/C01DZU7PW73\"><u>#kotlindl<\/u><\/a> (\u0438\u043d\u0432\u0430\u0439\u0442 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c <a href=\"http:\/\/slack.kotlinlang.org\/?_ga=2.28360636.1631899419.1619088615-984759609.1618823233\"><u>\u0442\u0443\u0442<\/u><\/a>). \u0412 \u043d\u0435\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u044f\u0445 \u0438 \u043f\u0435\u0440\u0432\u044b\u043c\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u0440\u0435\u0432\u044c\u044e-\u0440\u0435\u043b\u0438\u0437\u0430\u0445 \u0438 \u043d\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445 \u0432 \u0445\u0430\u0431\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439.<\/p>\n<p>\u0412\u0430\u0448\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u044c, \u0432\u0430\u0448\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0431\u0430\u0433\u043e\u0432 \u0438 \u043a\u0440\u0430\u0448-\u0440\u0435\u043f\u043e\u0440\u0442\u044b, \u0438\u0434\u0435\u0438 \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u2014 \u0432\u0441\u0435 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0441. \u041c\u044b \u0436\u0434\u0435\u043c \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u043a\u043e\u043d\u0442\u0440\u0438\u0431\u044c\u044e\u0442\u043e\u0440\u043e\u0432, \u043a\u0430\u043a \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0442\u0430\u043a \u0438 \u043e\u043f\u044b\u0442\u043d\u044b\u0445 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u2014 \u0432\u0441\u0435\u0445, \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b Deep Learning \u0438 Data Science \u043d\u0430 Kotlin, Java \u0438 Scala!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><\/p>\n<div class=\"tm-article-poll-container\"><!--[--><\/p>\n<div class=\"tm-article-poll tm-article-poll_variant-bordered\">\n<div class=\"tm-notice tm-notice_positive tm-article-poll__notice\"><!----><\/p>\n<div class=\"tm-notice__inner\"><!----><\/p>\n<div class=\"tm-notice__content\" data-test-id=\"notice-content\"><!--[--><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/companies\/JetBrains\/articles\/581462\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><!--]--><\/div>\n<\/div>\n<\/div>\n<p><!--[--><\/p>\n<div class=\"tm-article-poll__header\">\u041a\u0430\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 Deep Learning<\/div>\n<div class=\"tm-article-poll__answers\"><!--[--><\/p>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">57.14% <\/span><span class=\"tm-article-poll__answer-label\">Image Recognition<\/span><span class=\"tm-article-poll__answer-votes\">4<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width: 57.14%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">42.86% <\/span><span class=\"tm-article-poll__answer-label\">Object Detection<\/span><span class=\"tm-article-poll__answer-votes\">3<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 42.86%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">28.57% <\/span><span class=\"tm-article-poll__answer-label\">Pose Estimation<\/span><span class=\"tm-article-poll__answer-votes\">2<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 28.57%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">0% <\/span><span class=\"tm-article-poll__answer-label\">Natural Language Processing<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">14.29% <\/span><span class=\"tm-article-poll__answer-label\">Fraud Detection<\/span><span class=\"tm-article-poll__answer-votes\">1<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 14.29%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">14.29% <\/span><span class=\"tm-article-poll__answer-label\">Body segmentation<\/span><span class=\"tm-article-poll__answer-votes\">1<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 14.29%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">14.29% <\/span><span class=\"tm-article-poll__answer-label\">Face Detection<\/span><span class=\"tm-article-poll__answer-votes\">1<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 14.29%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">0% <\/span><span class=\"tm-article-poll__answer-label\">Hand Pose Detection<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">0% <\/span><span class=\"tm-article-poll__answer-label\">Text Toxicity Detection<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">0% <\/span><span class=\"tm-article-poll__answer-label\">\u0420\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f \u043d\u0430 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u0444\u0438\u0447\u0430\u0445<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">14.29% <\/span><span class=\"tm-article-poll__answer-label\">\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/span><span class=\"tm-article-poll__answer-votes\">1<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 14.29%\"><\/div>\n<\/div>\n<\/div>\n<p><!--]--><\/div>\n<div class=\"tm-article-poll__stats\"> \u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u0438 7 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.   \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u0438\u0441\u044c 2 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. <\/div>\n<p><!--]--><\/div>\n<p><!--]--><\/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\/articles\/581462\/\"> https:\/\/habr.com\/ru\/articles\/581462\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e 0.3 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f KotlinDL!<\/p>\n<p>\u0412\u0430\u0441 \u0436\u0434\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u043e\u0432\u044b\u0445 \u0444\u0438\u0447: \u043d\u043e\u0432\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 ModelHub (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u043b\u0438\u0446), \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043e\u0431\u0443\u0447\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 Keras \u0438 PyTorch \u0432 ONNX, \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 API \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u043e\u0432\u044b\u0445 \u0441\u043b\u043e\u0435\u0432, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u0438\u0431\u044c\u044e\u0442\u043e\u0440\u0430\u043c\u0438. \u0422\u0430\u043a\u0436\u0435 KotlinDL \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 <a href=\"https:\/\/search.maven.org\/artifact\/org.jetbrains.kotlinx\/kotlin-deeplearning-api\"><u>Maven Central<\/u><\/a>.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043a\u043e\u0441\u043d\u0435\u043c\u0441\u044f \u0441\u0430\u043c\u044b\u0445 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0440\u0435\u043b\u0438\u0437\u0430 0.3. \u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e <a href=\"https:\/\/github.com\/JetBrains\/KotlinDL\/blob\/master\/CHANGELOG.md\"><u>\u0441\u0441\u044b\u043b\u043a\u0435<\/u><\/a>.<\/p>\n<h2>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f ONNX <\/h2>\n<p>\u0412 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0433\u043e\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u0440\u043e\u0441\u0438\u043b\u0438 \u043d\u0430\u0441 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u043c\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 ONNX.<\/p>\n<p>Open Neural Network Exchange (ONNX) \u2014 \u044d\u0442\u043e \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 AI \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c. \u041e\u043d \u0437\u0430\u0434\u0430\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0433\u0440\u0430\u0444\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u0430\u043a\u0436\u0435 \u044d\u0442\u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 TensorFlow \u0438 PyTorch.<\/p>\n<p>\u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <a href=\"https:\/\/github.com\/microsoft\/onnxruntime\/tree\/master\/java\"><u>ONNX Runtime Java API<\/u><\/a> \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 `.onnx`. \u041e \u0442\u043e\u043c, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0435 API \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 <a href=\"https:\/\/onnxruntime.ai\/docs\/api\/java\/index.html\"><u>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/u><\/a>.<\/p>\n<p>\u0412 KotlinDL \u0435\u0441\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c `onnx` \u2014\u00a0\u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 ONNX. \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c ONNX \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e <a href=\"https:\/\/search.maven.org\/artifact\/org.jetbrains.kotlinx\/kotlin-deeplearning-onnx\/0.3.0-alpha-3\/jar\"><u>\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c <\/u><\/a>\u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p>\u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u044b \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 ONNX. \u0415\u0441\u043b\u0438 \u0432\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c LeNet-5 (\u043e\u0434\u043d\u0443 \u0438\u0437 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 ModelHub), \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0435\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"kotlin\">val (train, test) = mnist()  val modelHub = ONNXModelHub(cacheDirectory = File(\"cache\/pretrainedModels\"))  val modelType = ONNXModels.CV.Lenet val model = modelHub.loadModel(modelType)  model.use {    val prediction = it.predict(train.getX(0))     println(\"Predicted Label is: $prediction\")    println(\"Correct Label is: \" + train.getY(0)) }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 ONNX, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>OnnxInferenceModel<\/code>: <\/p>\n<pre><code class=\"kotlin\">OnnxInferenceModel.load(PATH_TO_MODEL).use {     val prediction = it.predict(...) }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0432\u044b\u0445\u043e\u0434, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439, \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0435\u043d\u0437\u043e\u0440\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 YOLOv4 \u0438\u043b\u0438 SSD), \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>predictRaw<\/code> :<\/p>\n<pre><code class=\"kotlin\">val yhat = it.predictRaw(inputData)<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c\u0443 \u0432\u044b\u0445\u043e\u0434\u0443 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<p>\u041d\u0430\u0439\u0442\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0432 <code>ONNXModelHub<\/code> \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e: \u043d\u0430\u0447\u043d\u0438\u0442\u0435 \u043f\u043e\u0438\u0441\u043a \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f <code>ONNXModels<\/code>, \u0441\u043f\u0443\u0441\u043a\u0430\u0439\u0442\u0435\u0441\u044c \u0433\u043b\u0443\u0431\u0436\u0435 \u0432 CV \u0438\u043b\u0438 ObjectDetection, \u0430 \u0437\u0430\u0442\u0435\u043c \u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u043c\u043e\u0434\u0435\u043b\u044f\u043c. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0443 \u0432\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u2014\u00a0\u043e\u043d\u0430 \u0438 \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u043b\u0438 \u0435\u0435 \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, EfficientNet \u2014\u00a0\u043e\u0434\u043d\u0430 \u0438\u0437 \u043b\u0443\u0447\u0448\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043f\u043e \u0438\u0442\u043e\u0433\u0430\u043c 2020 \u0433\u043e\u0434\u0430 \u2014 \u0438\u043c\u0435\u0435\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440: <code>ONNXModels.CV.EfficientNet4Lite<\/code>.<\/p>\n<h2>\u0414\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 (fine-tuning) ONNX-\u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/h2>\n<p>\u0414\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u044b \u043d\u0430 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u043e \u043a\u0430\u043a \u043d\u0430\u0441\u0447\u0435\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438\u0445 \u043f\u043e\u0434 \u043d\u0430\u0448\u0438 \u0437\u0430\u0434\u0430\u0447\u0438?<\/p>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, ONNX Java API \u043d\u0435 \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0443\u0447\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438. \u041d\u043e \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0432\u0441\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0446\u0435\u043b\u0438\u043a\u043e\u043c, \u0430 \u043b\u0438\u0448\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b.<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0437\u0430\u0434\u0430\u0447\u0438 Transfer Learning \u0434\u043b\u044f ResNet-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043c\u043e\u0440\u043e\u0437\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u043b\u043e\u0438, \u043a\u0440\u043e\u043c\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u0445\u043d\u0438\u0445 \u0441\u043b\u043e\u0435\u0432 (\u043f\u043e\u043b\u043d\u043e\u0441\u0432\u044f\u0437\u043d\u044b\u0445 \u0441\u043b\u043e\u0435\u0432, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0432\u044b\u0445\u043e\u0434 \u043c\u043e\u0434\u0435\u043b\u0438) \u043d\u0430 \u043d\u043e\u0432\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0412\u0435\u0440\u0445\u043d\u0438\u0435 \u0441\u043b\u043e\u0438 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c, \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u0438, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u0438\u0437 \u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u043b\u043e\u0435\u0432. \u0417\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0441\u043b\u043e\u0438 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430 \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u043b\u043d\u043e\u0441\u0432\u044f\u0437\u043d\u044b\u0445 \u0441\u043b\u043e\u0435\u0432.<\/p>\n<p>\u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0432 \u043d\u0430\u0448\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u043e\u0434\u0435\u043b\u044c ONNX \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 (\u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430) \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u043a \u043d\u0435\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 Sequential \u0438\u043b\u0438 Functional API.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0433\u0440\u043e\u043c\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0432 Keras \u0438\u043b\u0438 PyTorch, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0434\u043e\u043e\u0431\u0443\u0447\u0438\u0442\u044c \u0432 KotlinDL. \u0412\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u0440\u0435\u0437\u0430\u0442\u044c \u043e\u0442 \u043d\u0435\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0441\u043b\u043e\u0438, \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 ONNX, \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432 KotlinDL \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430 \u0447\u0435\u0440\u0435\u0437 ONNXModelPreprocessor, \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0435 \u0441\u043b\u043e\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e API KotlinDL \u0438 \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c.<\/p>\n<figure class=\"\"><figcaption>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 1. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u0441\u0435\u0442\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 ONNX.<\/figcaption><\/figure>\n<p>\u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a \u043c\u044b \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c ResNet50 \u0438\u0437 <code>ONNXModelHub<\/code> \u0438 \u0434\u043e\u043e\u0431\u0443\u0447\u0430\u0435\u043c \u0435\u0435 \u043d\u0430 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 Dogs-vs-Cats, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043c\u043e\u0433\u043b\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a\u043e\u0448\u0435\u043a \u0438 \u0441\u043e\u0431\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">val modelHub = ONNXModelHub(    cacheDirectory = File(\"cache\/pretrainedModels\") ) val model = modelHub.loadModel(ONNXModels.CV.ResNet50noTopCustom)  val dogsVsCatsDatasetPath = dogsCatsDatasetPath()  model.use {    it.reshape(64, 64, 3)     val preprocessing: Preprocessing = preprocess {        load {            pathToData = File(dogsVsCatsDatasetPath)            imageShape = ImageShape(channels = NUM_CHANNELS)            colorMode = ColorOrder.BGR            labelGenerator = FromFolders(mapping = mapOf(\"cat\" to 0, \"dog\" to 1))        }        transformImage {            resize {                outputHeight = IMAGE_SIZE.toInt()                outputWidth = IMAGE_SIZE.toInt()                interpolation = InterpolationType.BILINEAR            }        }        transformTensor {            sharpen {                modelType = TFModels.CV.ResNet50            }            onnx {                onnxModel = model            }        }    }     val dataset = OnFlyImageDataset.create(preprocessing).shuffle()    val (train, test) = dataset.split(TRAIN_TEST_SPLIT_RATIO)     topModel.use {        topModel.compile(            optimizer = Adam(),            loss = Losses.SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS,            metric = Metrics.ACCURACY        )         topModel.fit(dataset = train, epochs = EPOCHS, batchSize = TRAINING_BATCH_SIZE)         val accuracy = topModel.evaluate(dataset = test, batchSize = TEST_BATCH_SIZE).metrics[Metrics.ACCURACY]         println(\"Accuracy: $accuracy\")    } }<\/code><\/pre>\n<p><code>topModel<\/code> \u2014 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0431\u0443\u0447\u0438\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<pre><code class=\"kotlin\">\/** * This is a simple model based on Dense layers only. *\/ private val topModel = Sequential.of(    Input(2, 2, 2048),    GlobalAvgPool2D(),    Dense(2, Activations.Linear, kernelInitializer = HeNormal(12L), biasInitializer = Zeros()) )<\/code><\/pre>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e <a href=\"https:\/\/github.com\/JetBrains\/KotlinDL\/blob\/master\/examples\/src\/main\/kotlin\/examples\/onnx\/cv\/custom\/additionalTrainingWithTensorFlow.kt\"><u>\u0441\u0441\u044b\u043b\u043a\u0435<\/u><\/a>.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 API \u0434\u043b\u044f \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u044f \u0441\u043b\u043e\u0435\u0432 \u0438 \u0432\u044b\u043a\u043e\u0440\u0447\u0435\u0432\u044b\u0432\u0430\u043d\u0438\u044f \u0432\u0435\u0441\u043e\u0432 \u0438\u0437 \u043c\u043e\u0434\u0435\u043b\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0439 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 ONNX, \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0434 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u043e\u043c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 ONNX. \u0414\u0430, \u044d\u0442\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 Python. \u041d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u0439\u0442\u0435: \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0435\u043b\u0438\u0437\u0435 \u043c\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 ModelHub \u043c\u043d\u043e\u0433\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438\u0437 PyTorch \u0438 Keras \u0441 \u0443\u0436\u0435 \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c\u0438 \u0441\u043b\u043e\u044f\u043c\u0438.<\/p>\n<h2>ModelHub: \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438\u0437 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432 DenseNet, Inception \u0438 NasNet<\/h2>\n<p>\u0412 KotlinDL 0.2 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043d\u0430\u0437\u0432\u0430\u043b\u0438 \u0435\u0433\u043e ModelZoo, \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043b\u0438 \u0432 ModelHub.<\/p>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 <code>ModelHub<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u044b \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a <a href=\"https:\/\/www.image-net.org\/\"><u>ImageNet<\/u><\/a> \u0438 <a href=\"https:\/\/cocodataset.org\/#home\"><u>COCO<\/u><\/a><\/p>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0435\u0441\u0442\u044c \u0434\u0432\u0430 <code>ModelHub<\/code>, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438: \u0431\u0430\u0437\u043e\u0432\u044b\u0439 <code>TFModelHub<\/code>, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 `api`, \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 <code>ONNXModelHub<\/code>, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435` onnx`.<\/p>\n<figure class=\"full-width\"><figcaption>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 2. \u0418\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 ModelHub.<\/figcaption><\/figure>\n<p>TFModelHub \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u043e\u0434\u0435\u043b\u0438:<\/p>\n<ul>\n<li>\n<p>VGG\u201916<\/p>\n<\/li>\n<li>\n<p>VGG\u201919<\/p>\n<\/li>\n<li>\n<p>ResNet18<\/p>\n<\/li>\n<li>\n<p>ResNet34<\/p>\n<\/li>\n<li>\n<p>ResNet50<\/p>\n<\/li>\n<li>\n<p>ResNet101<\/p>\n<\/li>\n<li>\n<p>ResNet152<\/p>\n<\/li>\n<li>\n<p>ResNet50v2<\/p>\n<\/li>\n<li>\n<p>ResNet101v2<\/p>\n<\/li>\n<li>\n<p>ResNet152v2<\/p>\n<\/li>\n<li>\n<p>MobileNet<\/p>\n<\/li>\n<li>\n<p>MobileNetv2<\/p>\n<\/li>\n<li>\n<p>Inception<\/p>\n<\/li>\n<li>\n<p>Xception<\/p>\n<\/li>\n<li>\n<p>DenseNet121<\/p>\n<\/li>\n<li>\n<p>DenseNet169<\/p>\n<\/li>\n<li>\n<p>DenseNet201<\/p>\n<\/li>\n<li>\n<p>NASNetMobile<\/p>\n<\/li>\n<li>\n<p>NASNetLarge<\/p>\n<\/li>\n<\/ul>\n<p>ONNXModelHub \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u043e\u0434\u0435\u043b\u0438:<\/p>\n<p><strong>CV<\/strong><\/p>\n<ul>\n<li>\n<p>Lenet<\/p>\n<\/li>\n<li>\n<p>ResNet18<\/p>\n<\/li>\n<li>\n<p>ResNet34<\/p>\n<\/li>\n<li>\n<p>ResNet50<\/p>\n<\/li>\n<li>\n<p>ResNet101<\/p>\n<\/li>\n<li>\n<p>ResNet152<\/p>\n<\/li>\n<li>\n<p>ResNet50v2<\/p>\n<\/li>\n<li>\n<p>ResNet101v2<\/p>\n<\/li>\n<li>\n<p>ResNet152v2<\/p>\n<\/li>\n<li>\n<p>EfficientNet4Lite<\/p>\n<\/li>\n<\/ul>\n<p><strong>ObjectDetection<\/strong><\/p>\n<ul>\n<li>\n<p>SSD<\/p>\n<\/li>\n<\/ul>\n<p><strong>FaceAlignment<\/strong><\/p>\n<ul>\n<li>\n<p>Fan2d106<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 <code>TFModelHub<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438 \u0432\u0435\u0441\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u0430\u0441\u044c \u043f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0430 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 <a href=\"http:\/\/www.image-net.org\/\"><u>ImageNet<\/u><\/a>. \u0415\u0441\u043b\u0438 \u0437\u0430\u0431\u044b\u0442\u044c \u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043a \u0432\u0445\u043e\u0434\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u043c\u043e\u0434\u0435\u043b\u0438, \u0442\u043e \u0432\u044b\u0445\u043e\u0434 \u0432\u0430\u0441 \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e \u0443\u0434\u0438\u0432\u0438\u0442.<\/p>\n<p>\u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c ResNet50 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"kotlin\">val modelHub = TFModelHub(cacheDirectory = File(\"cache\/pretrainedModels\")) val model = modelHub.loadModel(TFModels.CV.ResNet50)  val imageNetClassLabels = modelHub.loadClassLabels()  model.use {     val hdfFile = modelHub.loadWeights(TFModels.CV.ResNet50)     it.loadWeights(hdfFile) \u2026 }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0432\u0435\u0441\u0430 \u043c\u043e\u0434\u0435\u043b\u0438. \u0414\u0430\u043b\u0435\u0435 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 KotlinDL.<\/p>\n<blockquote>\n<p>\u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433 \u043d\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 ModelHub \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0441\u0432\u043e\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430 <code>preprocessInput<\/code>:<\/p>\n<\/blockquote>\n<pre><code class=\"kotlin\">val inputData = modelType.preprocessInput(...) val res = it.predict(inputData)<\/code><\/pre>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 ResNet\u201950 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043d\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u044d\u0442\u043e\u043c <a href=\"https:\/\/github.com\/JetBrains\/KotlinDL\/blob\/master\/docs\/transfer_learning_functional.md\"><u>\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435<\/u><\/a>.<\/p>\n<blockquote>\n<p>\u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 ONNX \u0432\u0430\u043c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0432\u0435\u0441\u0430 (\u0441\u043c. \u0440\u0430\u0437\u0434\u0435\u043b \u00ab\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f ONNX\u00bb \u0432\u044b\u0448\u0435).<\/p>\n<\/blockquote>\n<h2>\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 \u043c\u043e\u0434\u0435\u043b\u0438 SSD<\/h2>\n<p>\u041f\u0440\u043e\u0448\u043b\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f ModelHub \u0432\u043a\u043b\u044e\u0447\u0430\u043b\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 (Image Recognition). \u041c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438. \u0412 \u044d\u0442\u043e\u043c \u0440\u0435\u043b\u0438\u0437\u0435 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c <a href=\"https:\/\/arxiv.org\/pdf\/1512.02325.pdf\"><u>Single Shot MultiBox Detector (SSD)<\/u><\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445 (\u0437\u0430\u0434\u0430\u0447\u0430 Object Detection).<\/p>\n<figure class=\"full-width\"><figcaption>\u0420\u0438\u0443\u043d\u043e\u043a 3. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0432\u0435\u0440\u0442\u043e\u0447\u043d\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0441 \u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 SSD<\/figcaption><\/figure>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 Object Detection \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438. \u041f\u0440\u0438\u0447\u0435\u043c \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c \u0444\u0430\u043a\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0442\u0430\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u043e \u0435\u0449\u0435 \u0438 \u0438\u0445 \u0433\u0440\u0430\u043d\u0438\u0446\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0432\u043f\u0438\u0441\u0430\u043d).<\/p>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c SSD \u043e\u0431\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 <a href=\"https:\/\/paperswithcode.com\/dataset\/coco\"><u>COCO<\/u><\/a>, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u043c \u0438\u0437 328 000 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0437\u0430\u0434\u0430\u043d\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0435 \u0440\u0430\u043c\u043a\u0438 \u0438 \u043c\u0430\u0441\u043a\u0438 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0434\u043d\u0430 \u0438\u0437 80 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u00ab\u0447\u0435\u043b\u043e\u0432\u0435\u043a\u00bb,<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-402171","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/402171","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=402171"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/402171\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=402171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=402171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=402171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}