{"id":89110,"date":"2020-07-18T19:42:10","date_gmt":"2020-07-18T17:42:10","guid":{"rendered":"https:\/\/prohoster.info\/blog\/administrirovanie\/obshhij-obzor-arhitektury-servisa-dlya-oczenki-vneshnosti-na-osnove-nejronnyh-setej"},"modified":"2020-07-18T19:42:10","modified_gmt":"2020-07-18T17:42:10","slug":"obshhij-obzor-arhitektury-servisa-dlya-oczenki-vneshnosti-na-osnove-nejronnyh-setej","status":"publish","type":"post","link":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/obshhij-obzor-arhitektury-servisa-dlya-oczenki-vneshnosti-na-osnove-nejronnyh-setej","title":{"rendered":"Kampion p\u00ebrmbledh\u00ebs i arkitektur\u00ebs s\u00eb sh\u00ebrbimit p\u00ebr vler\u00ebsimin e pamjes mbi baza t\u00eb rrjeteve neuronale","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><img decoding=\"async\" alt=\"Kampion p\u00ebrmbledh\u00ebs i arkitektur\u00ebs s\u00eb sh\u00ebrbimit p\u00ebr vler\u00ebsimin e pamjes mbi baza t\u00eb rrjeteve neuronale\" src=\"\/wp-content\/uploads\/2020\/07\/f624e995fbee3496f1f7890b98106df4.png\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<h2>Hyrje<\/h2>\n<p><\/p>\n<p>P\u00ebrsh\u00ebndetje!<\/p>\n<p><\/p>\n<p>N\u00eb k\u00ebt\u00eb artikull do t\u00eb ndaj p\u00ebrvoj\u00ebn time n\u00eb nd\u00ebrtimin e nj\u00eb arkitekture mikrosh\u00ebrbimesh p\u00ebr nj\u00eb projekt q\u00eb p\u00ebrdor rrjete nervore.<\/p>\n<p><\/p>\n<p>Do t\u00eb flasim p\u00ebr k\u00ebrkesat e arkitektur\u00ebs, do t\u00eb shohim diagrame t\u00eb ndryshme strukturore, do t\u00eb analizojm\u00eb secilin nga komponent\u00ebt e arkitektur\u00ebs s\u00eb gatshme dhe do t\u00eb vler\u00ebsojm\u00eb metrikat teknike t\u00eb zgjidhjes.<\/p>\n<p><\/p>\n<p>Lexim t\u00eb k\u00ebndsh\u00ebm!<\/p>\n<p><noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h2>Disa fjal\u00eb p\u00ebr detyr\u00ebn dhe zgjidhjen e saj<\/h2>\n<p><\/p>\n<p>Ideja kryesore \u2013 t\u00eb ofrohet nj\u00eb vler\u00ebsim p\u00ebr t\u00ebrheqjen e nj\u00eb personi n\u00eb nj\u00eb shkall\u00eb nga 1 n\u00eb 10 bazuar n\u00eb fotografi.<\/p>\n<p><\/p>\n<p>N\u00eb k\u00ebt\u00eb artikull do t\u00eb shmangim p\u00ebrshkrimin e rrjeteve nervore t\u00eb p\u00ebrdorura, si dhe procesin e p\u00ebrgatitjes s\u00eb t\u00eb dh\u00ebnave dhe m\u00ebsimit. Megjithat\u00eb, n\u00eb nj\u00eb nga botimet e ardhshme, ne do t\u00eb rikthehemi n\u00eb analiz\u00ebn e pipeline-it t\u00eb vler\u00ebsimit n\u00eb nj\u00eb nivel m\u00eb t\u00eb thell\u00eb.<\/p>\n<p><\/p>\n<p>Aktualisht ne do t\u00eb kalojm\u00eb n\u00ebp\u00ebr pipeline-in e vler\u00ebsimit, duke u fokusuar n\u00eb nd\u00ebrveprimin e mikrosh\u00ebrbimeve n\u00eb kontekstin e arkitektur\u00ebs s\u00eb p\u00ebrgjithshme t\u00eb projektit.\u00a0<\/p>\n<p><\/p>\n<p>Kur punonim mbi pipeline-in e vler\u00ebsimit t\u00eb t\u00ebrheqjes, detyra u dekompozua n\u00eb komponent\u00ebt e m\u00ebposht\u00ebm:<\/p>\n<p><\/p>\n<ol>\n<li>Identifikimi i fytyrave n\u00eb foto<\/li>\n<li>Vler\u00ebsimi i \u00e7do fytyre<\/li>\n<li>Renderimi i rezultatit<\/li>\n<\/ol>\n<p><\/p>\n<p>E para zgjidhet nga nj\u00eb model i trajnuar m\u00eb par\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/arxiv.org\/abs\/1604.02878\">MTCNN<\/a><\/noindex>. P\u00ebr t\u00eb dyt\u00ebn, nj\u00eb rrjet nervor konvolucional u trajnuar n\u00eb PyTorch, si backbone u p\u00ebrdor <noindex><a rel=\"nofollow\" href=\"https:\/\/arxiv.org\/abs\/1512.03385\">ResNet34<\/a><\/noindex> \u2013 nga balanca \"cil\u00ebsi \/ shpejt\u00ebsia e inferenc\u00ebs n\u00eb CPU\"<\/p>\n<p>\n<img decoding=\"async\" alt=\"Kampion p\u00ebrmbledh\u00ebs i arkitektur\u00ebs s\u00eb sh\u00ebrbimit p\u00ebr vler\u00ebsimin e pamjes mbi baza t\u00eb rrjeteve neuronale\" src=\"\/wp-content\/uploads\/2020\/07\/181cc89a2cf5295bdcd4b838216f96d6.png\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><i>Diagrami funksional i pipeline-it t\u00eb vler\u00ebsimit<\/i><\/p>\n<p><\/p>\n<h2>Analiza e k\u00ebrkesave p\u00ebr arkitektur\u00ebn e projektit<\/h2>\n<p><\/p>\n<p>N\u00eb ciklin e jet\u00ebs <noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/Machine_learning\">ML<\/a><\/noindex> etapat e pun\u00ebs mbi arkitektur\u00ebn dhe automatizimin e shp\u00ebrndarjes s\u00eb modelit, shpeshher\u00eb jan\u00eb disa nga ato m\u00eb t\u00eb kushtueshme n\u00eb koh\u00eb dhe burime.<\/p>\n<p>\n<img decoding=\"async\" alt=\"Kampion p\u00ebrmbledh\u00ebs i arkitektur\u00ebs s\u00eb sh\u00ebrbimit p\u00ebr vler\u00ebsimin e pamjes mbi baza t\u00eb rrjeteve neuronale\" src=\"\/wp-content\/uploads\/2020\/07\/4949f217d31c863176122ed87b43a88c.png\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><i>Cikli i jet\u00ebs s\u00eb projektit ML<\/i><\/p>\n<p><\/p>\n<p>Ky projekt nuk \u00ebsht\u00eb p\u00ebrjashtim \u2013 u mor vendimi p\u00ebr t\u00eb mb\u00ebshtjell\u00eb pipeline-in e vler\u00ebsimit n\u00eb nj\u00eb sh\u00ebrbim online, p\u00ebr k\u00ebt\u00eb ishte e nevojshme t\u00eb thellohej n\u00eb arkitektur\u00eb. U p\u00ebrcaktuan k\u00ebrkesat baz\u00eb t\u00eb m\u00ebposhtme:<\/p>\n<p><\/p>\n<ol>\n<li>Nj\u00eb magazin\u00eb e vetme log-esh \u2013 t\u00eb gjitha sh\u00ebrbimet duhet t\u00eb shkruajn\u00eb log-\u00ebt n\u00eb nj\u00eb vend, ato duhet t\u00eb jen\u00eb leht\u00ebsisht t\u00eb analizueshme<\/li>\n<li>Mund\u00ebsia e shkall\u00ebzimit horizontal t\u00eb sh\u00ebrbimit t\u00eb vler\u00ebsimit \u2014 si Bottleneck m\u00eb i mundsh\u00ebm<\/li>\n<li>P\u00ebr \u00e7do imazh duhet t\u00eb caktuar nj\u00eb sasi e barabart\u00eb burimesh t\u00eb procesorit \u2014 p\u00ebr t\u00eb shmangur devijimet n\u00eb shp\u00ebrndarjen e koh\u00ebs p\u00ebr inferenc\u00eb<\/li>\n<li>Rip\u00ebrhapje e shpejt\u00eb (ri) e sh\u00ebrbimeve specifike, si dhe e stak\u00ebs n\u00eb t\u00ebr\u00ebsi<\/li>\n<li>Mund\u00ebsia p\u00ebr t\u00eb p\u00ebrdorur objekte t\u00eb p\u00ebrbashk\u00ebta n\u00eb sh\u00ebrbime t\u00eb ndryshme, n\u00ebse \u00ebsht\u00eb e nevojshme.<\/li>\n<\/ol>\n<p><\/p>\n<h2>Arkitektura<\/h2>\n<p><\/p>\n<p>Pas analizimit t\u00eb k\u00ebrkesave, u b\u00eb e qart\u00eb se arkitektura mikrosh\u00ebrbimore p\u00ebrshtatet pothuajse perfekt.<\/p>\n<p><\/p>\n<p>P\u00ebr t\u00eb shmangur dhimbjet e panevojshme, u zgjodh Telegram API si frontend.<\/p>\n<p><\/p>\n<p>Faza e par\u00eb \u00ebsht\u00eb shqyrtimi i diagram\u00ebs strukturore t\u00eb arkitektur\u00ebs p\u00ebrfundimtare, m\u00eb pas do t\u00eb kalojm\u00eb n\u00eb p\u00ebrshkrimin e secilit komponent dhe do t\u00eb formulojm\u00eb procesin e p\u00ebrpunimit t\u00eb suksessh\u00ebm t\u00eb imazheve.<\/p>\n<p>\n<img decoding=\"async\" alt=\"Kampion p\u00ebrmbledh\u00ebs i arkitektur\u00ebs s\u00eb sh\u00ebrbimit p\u00ebr vler\u00ebsimin e pamjes mbi baza t\u00eb rrjeteve neuronale\" src=\"\/wp-content\/uploads\/2020\/07\/163ec019341e9d71a1e0854c6026bd01.png\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><i>Diagrami struktural i arkitektur\u00ebs p\u00ebrfundimtare<\/i><\/p>\n<p><\/p>\n<p>T\u00eb flasim m\u00eb n\u00eb detaje mbi secilin nga komponent\u00ebt e diagram\u00ebs, duke ndar\u00eb p\u00ebrgjegj\u00ebsin\u00eb e tyre t\u00eb vetme n\u00eb procesin e vler\u00ebsimit t\u00eb imazhit.<\/p>\n<p><\/p>\n<h3>Mikrosherbimi \u00abattrai-telegram-bot\u00bb<\/h3>\n<p><\/p>\n<p>Ky mikrosh\u00ebrbim inkapsulon t\u00eb gjitha nd\u00ebrveprimet me Telegram API. Mund t\u00eb dallojm\u00eb dy skenar\u00eb kryesor\u00eb \u2013 punimi me imazhin e p\u00ebrdoruesit dhe punimi me rezultatin e procesit t\u00eb vler\u00ebsimit. Do t\u00eb shqyrtojm\u00eb t\u00eb dyja skenar\u00ebt n\u00eb p\u00ebrmbledhje.<\/p>\n<p><\/p>\n<p>Kur merrni nj\u00eb mesazh t\u00eb p\u00ebrdoruesit me nj\u00eb imazh:<\/p>\n<p><\/p>\n<ol>\n<li>Kryhet filtrimi, i cili p\u00ebrfshin k\u00ebto kontrollime:\n<ul>\n<li>Prania e madh\u00ebsis\u00eb optimale t\u00eb imazhit<\/li>\n<li>Numri i imazheve t\u00eb p\u00ebrdoruesit q\u00eb tashm\u00eb jan\u00eb n\u00eb radh\u00eb<\/li>\n<\/ul>\n<\/li>\n<li>Gjat\u00eb kalimit t\u00eb filt\u00ebr primar, imazhi ruhet n\u00eb docker volume<\/li>\n<li>N\u00eb radh\u00ebn \u201cto_estimate\u201d prodhohet nj\u00eb detyr\u00eb, ku, nd\u00ebr t\u00eb tjera, p\u00ebrfshihet rruga deri te imazhi, q\u00eb ndodhet n\u00eb volume ton\u00eb<\/li>\n<li>N\u00ebse hapat e m\u00ebsip\u00ebrm p\u00ebrfundojn\u00eb me sukses - p\u00ebrdoruesi do t\u00eb marr\u00eb nj\u00eb mesazh me koh\u00ebn e p\u00ebraf\u00ebrt t\u00eb p\u00ebrpunimit t\u00eb imazhit, e cila llogaritet n\u00eb baz\u00eb t\u00eb numrit t\u00eb detyrave n\u00eb radh\u00eb. N\u00eb rast gabimi, p\u00ebrdoruesi do t\u00eb njoftohet qart\u00eb - duke d\u00ebrguar nj\u00eb mesazh me informacionin se \u00e7far\u00eb mund t\u00eb ket\u00eb shkuar keq. <\/li>\n<\/ol>\n<p><\/p>\n<p>Gjithashtu, ky mikrosh\u00ebrbim, si pun\u00ebtor celere, d\u00ebgjon radh\u00ebn \u201cafter_estimate\u201d, e cila \u00ebsht\u00eb e destinuar p\u00ebr detyrat q\u00eb kan\u00eb kaluar p\u00ebrmes pipeline-it t\u00eb vler\u00ebsimit.<\/p>\n<p><\/p>\n<p>Kur marrim nj\u00eb detyr\u00eb t\u00eb re nga \u201cafter_estimate\u201d:<\/p>\n<p><\/p>\n<ol>\n<li>N\u00ebse imazhi \u00ebsht\u00eb p\u00ebrpunuar me sukses - i d\u00ebrgojm\u00eb rezultatin p\u00ebrdoruesit, n\u00eb t\u00eb kund\u00ebrt - njoftojm\u00eb p\u00ebr gabimin<\/li>\n<li>Fshijm\u00eb imazhin, q\u00eb \u00ebsht\u00eb rezultati i pipeline-it t\u00eb vler\u00ebsimit<\/li>\n<\/ol>\n<p><\/p>\n<h3>Mikrosh\u00ebrbimi i vler\u00ebsimit \u201cattrai-estimator\u201d<\/h3>\n<p><\/p>\n<p>Ky mikrosh\u00ebrbim \u00ebsht\u00eb pun\u00ebtor celere dhe inkapsulon gjith\u00e7ka q\u00eb lidhet me pipeline-in e vler\u00ebsimit t\u00eb imazhit. Algoritmi i pun\u00ebs k\u00ebtu \u00ebsht\u00eb nj\u00eb - do ta shqyrtojm\u00eb at\u00eb.<\/p>\n<p><\/p>\n<p>Kur marrim nj\u00eb detyr\u00eb t\u00eb re nga \u201cto_estimate\u201d:<\/p>\n<p><\/p>\n<ol>\n<li>Kaluajm\u00eb imazhin p\u00ebrmes pipeline-it t\u00eb vler\u00ebsimit:\n<ol>\n<li>Ngarkohet imazhi n\u00eb memorje<\/li>\n<li>Rregullojm\u00eb imazhin n\u00eb madh\u00ebsin\u00eb e duhur<\/li>\n<li>Gjejm\u00eb t\u00eb gjitha fytyrat (MTCNN)<\/li>\n<li>Vler\u00ebsojm\u00eb t\u00eb gjitha fytyrat (mb\u00ebshtjellim fytyrat e gjetura m\u00eb par\u00eb n\u00eb nj\u00eb grup dhe b\u00ebjm\u00eb inferenc\u00ebn me ResNet34)<\/li>\n<li>Renderojm\u00eb imazhin p\u00ebrfundimtar\n<ol>\n<li>Vizatojm\u00eb kutit\u00eb ndihm\u00ebse<\/li>\n<li>Vizatojm\u00eb vler\u00ebsimet<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<\/li>\n<li>Fshijm\u00eb imazhin origjinal nga p\u00ebrdoruesi<\/li>\n<li>Ruajm\u00eb daljen nga pipeline-i i vler\u00ebsimit<\/li>\n<li>Vendosim detyr\u00ebn n\u00eb radh\u00eb \"after_estimate\", e cila d\u00ebgjohet nga mikrosh\u00ebrbisi i p\u00ebrmendur m\u00eb sip\u00ebr \"attrai-telegram-bot\"<\/li>\n<\/ol>\n<p><\/p>\n<h3>Graylog (+ mongoDB + Elasticsearch)<\/h3>\n<p><\/p>\n<p><noindex><a rel=\"nofollow\" href=\"https:\/\/www.graylog.org\/\">Graylog<\/a><\/noindex> \u00ebsht\u00eb nj\u00eb zgjidhje p\u00ebr menaxhimin qendror t\u00eb log-eve. N\u00eb k\u00ebt\u00eb projekt, ai \u00ebsht\u00eb p\u00ebrdorur sipas q\u00ebllimeve t\u00eb tij t\u00eb drejta.<\/p>\n<p><\/p>\n<p>Zgjedhja ra pik\u00ebrisht mbi t\u00eb, dhe jo mbi stakun e njohur p\u00ebr t\u00eb gjith\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/www.elastic.co\/what-is\/elk-stack\">ELK<\/a><\/noindex> p\u00ebr shkak t\u00eb leht\u00ebsis\u00eb s\u00eb pun\u00ebs me t\u00eb nga Python. Gjith\u00e7ka q\u00eb duhet b\u00ebr\u00eb p\u00ebr logimin n\u00eb Graylog \u00ebsht\u00eb t\u00eb shtoni GELFTCPHandler nga paketa <noindex><a rel=\"nofollow\" href=\"https:\/\/pypi.org\/project\/graypy\/\">graypy<\/a><\/noindex> n\u00eb handler-at tjer\u00eb root logger t\u00eb mikrosh\u00ebrbisit ton\u00eb python.<\/p>\n<p><\/p>\n<p>Un\u00eb, si nj\u00eb person q\u00eb m\u00eb par\u00eb ka punuar vet\u00ebm me stakun ELK, n\u00eb p\u00ebrgjith\u00ebsi kam pasur nj\u00eb p\u00ebrvoj\u00eb pozitive gjat\u00eb pun\u00ebs me Graylog. E vetmja gj\u00eb q\u00eb m\u00eb shqet\u00ebson \u00ebsht\u00eb superioriteti i karakteristikave t\u00eb Kibana-s ndaj nd\u00ebrfaqes s\u00eb web-it t\u00eb Graylog.<\/p>\n<p><\/p>\n<h3>RabbitMQ<\/h3>\n<p><\/p>\n<p><noindex><a rel=\"nofollow\" href=\"https:\/\/www.rabbitmq.com\/\">RabbitMQ<\/a><\/noindex> \u2014 \u00ebsht\u00eb nj\u00eb broker mesazhesh i bazuar n\u00eb protokollin AMQP.<\/p>\n<p><\/p>\n<p>N\u00eb k\u00ebt\u00eb projekt, ai u p\u00ebrdor si <noindex><a rel=\"nofollow\" href=\"https:\/\/docs.celeryproject.org\/en\/latest\/getting-started\/brokers\/#broker-overview\">brokeri m\u00eb stabil dhe i provuar me koh\u00ebn<\/a><\/noindex> p\u00ebr Celery dhe punoi n\u00eb modalitetin durable.<\/p>\n<p><\/p>\n<h3>Redis<\/h3>\n<p><\/p>\n<p><noindex><a rel=\"nofollow\" href=\"https:\/\/redis.io\/\">Redis<\/a><\/noindex> \u2014 \u00ebsht\u00eb nj\u00eb DBMS NoSQL q\u00eb punon me struktura t\u00eb dh\u00ebnash t\u00eb tipit \"\u00e7el\u00ebs \u2014 vler\u00eb\".<\/p>\n<p><\/p>\n<p>Ndonj\u00ebher\u00eb lind nevoja p\u00ebr t\u00eb p\u00ebrdorur objekte t\u00eb zakonshme n\u00eb mikrosh\u00ebrbime t\u00eb ndryshme Python, t\u00eb cilat implementojn\u00eb disa struktura t\u00eb dh\u00ebnash.<\/p>\n<p><\/p>\n<p>P\u00ebr shembull, n\u00eb Redis ruhet nj\u00eb hashmap i tipit \"telegram_user_id =&gt; numri i task-eve aktive n\u00eb radh\u00eb\", \u00e7ka lejon kufizimin e numrit t\u00eb k\u00ebrkesave nga nj\u00eb p\u00ebrdorues n\u00eb nj\u00eb vler\u00eb t\u00eb caktuar dhe, n\u00eb k\u00ebt\u00eb m\u00ebnyr\u00eb, parandalon sulmet DoS.<\/p>\n<p><\/p>\n<h3>Formulojm\u00eb procesin e trajtimit t\u00eb suksessh\u00ebm t\u00eb imazhit<\/h3>\n<p><\/p>\n<ol>\n<li>P\u00ebrdoruesi d\u00ebrgon nj\u00eb imazh n\u00eb botin Telegram<\/li>\n<li>\"attrai-telegram-bot\" merr mesazhin nga API i Telegram dhe e analizojn\u00eb at\u00eb<\/li>\n<li>Tasku me imazhin shtohet n\u00eb radh\u00ebn asinkrone \"to_estimate\"<\/li>\n<li>P\u00ebrdoruesi merr nj\u00eb mesazh me koh\u00ebn e parashikuar p\u00ebr vler\u00ebsim<\/li>\n<li>\"attrai-estimator\" merr taskun nga radh\u00eb \"to_estimate\", e kalon at\u00eb p\u00ebrmes tubit t\u00eb vler\u00ebsimit dhe e prodhon taskun n\u00eb radh\u00ebn \"after_estimate\"<\/li>\n<li>\"attrai-telegram-bot\", q\u00eb d\u00ebgjon radh\u00ebn \"after_estimate\", i d\u00ebrgon rezultatin p\u00ebrdoruesit<\/li>\n<\/ol>\n<p><\/p>\n<h2>DevOps<\/h2>\n<p><\/p>\n<p>Finally, after reviewing the architecture, we can move on to the no less interesting part \u2014 DevOps<\/p>\n<p><\/p>\n<h3>Docker Swarm<\/h3>\n<p><\/p>\n<p>\u00a0<\/p>\n<p>\n<img decoding=\"async\" alt=\"Kampion p\u00ebrmbledh\u00ebs i arkitektur\u00ebs s\u00eb sh\u00ebrbimit p\u00ebr vler\u00ebsimin e pamjes mbi baza t\u00eb rrjeteve neuronale\" src=\"\/wp-content\/uploads\/2020\/07\/ba539d1c8197c7961d6e5e6a5c7e83c6.png\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><noindex><a rel=\"nofollow\" href=\"https:\/\/docs.docker.com\/engine\/swarm\/\">Docker Swarm <\/a><\/noindex>\u00a0\u2014 nj\u00eb sistem klasterimi, funksionaliteti i t\u00eb cilit \u00ebsht\u00eb realizuar brenda Docker Engine dhe \u00ebsht\u00eb i disponuesh\u00ebm nga kutia.<\/p>\n<p><\/p>\n<p>Using the \u2018swarm\u2019, all nodes in our cluster can be divided into 2 types \u2013 worker and manager. Containers (stacks) are deployed on machines of the first type, while machines of the second type are responsible for scaling, balancing, and <noindex><a rel=\"nofollow\" href=\"https:\/\/docs.docker.com\/engine\/swarm\/#feature-highlights\">other cool features<\/a><\/noindex>. Managers are, by default, also workers.<\/p>\n<p>\n<img decoding=\"async\" alt=\"Kampion p\u00ebrmbledh\u00ebs i arkitektur\u00ebs s\u00eb sh\u00ebrbimit p\u00ebr vler\u00ebsimin e pamjes mbi baza t\u00eb rrjeteve neuronale\" src=\"\/wp-content\/uploads\/2020\/07\/d195e2aab6d3552652102c2b5246abfc.png\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><i>A cluster with one leader manager and three workers<\/i><\/p>\n<p><\/p>\n<p>The minimum possible size of a cluster is 1 node, with a single machine acting as both the leader manager and worker. Based on the project size and minimal fault tolerance requirements, it was decided to use this approach.<\/p>\n<p><\/p>\n<p>To get ahead of myself, I\u2019ll say that since the first production deployment in mid-June, there have been no issues related to this cluster organization (but this doesn\u2019t mean that such an organization is acceptable in any medium-large projects that have reliability requirements).<\/p>\n<p><\/p>\n<h3>Docker Stack<\/h3>\n<p><\/p>\n<p>N\u00eb modin \u00abswarm\u00bb, p\u00ebr shp\u00ebrndarjen e stek\u00ebve (grupeve t\u00eb sh\u00ebrbimeve docker) \u00ebsht\u00eb p\u00ebrgjegj\u00ebs <noindex><a rel=\"nofollow\" href=\"https:\/\/docs.docker.com\/engine\/reference\/commandline\/stack\/\">docker stack<\/a><\/noindex><\/p>\n<p><\/p>\n<p>Ai mb\u00ebshtet konfigurimet docker-compose, duke lejuar p\u00ebrdorimin e parametrave t\u00eb shp\u00ebrndarjes.\u00a0\u00a0<\/p>\n<p><\/p>\n<p>P\u00ebr shembull, me k\u00ebta parametra jan\u00eb kufizuar burimet p\u00ebr \u00e7do instanc\u00eb t\u00eb mikrosh\u00ebrbimit t\u00eb vler\u00ebsimit (i alokoni N instancave N b\u00ebrthama, n\u00eb mikrosh\u00ebrbim kufizojm\u00eb numrin e b\u00ebrthamave, q\u00eb p\u00ebrdoret nga PyTorch, n\u00eb nj\u00eb)<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">attrai_estimator:\n\u00a0\u00a0image: 'erqups\/attrai_estimator:1.2'\n\u00a0\u00a0deploy:\n\u00a0\u00a0\u00a0\u00a0replicas: 4\n\u00a0\u00a0\u00a0\u00a0resources:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0limits:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0cpus: '4'\n\u00a0\u00a0\u00a0\u00a0restart_policy:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0condition: on-failure\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2026<\/code><\/pre>\n<p><\/p>\n<p>\u00cbsht\u00eb e r\u00ebnd\u00ebsishme t\u00eb theksohet se Redis, RabbitMQ dhe Graylog jan\u00eb sh\u00ebrbime stateful dhe nuk \u00ebsht\u00eb kaq e leht\u00eb t\u2019i shkall\u00ebzosh si \u00abattrai-estimator\u00bb<\/p>\n<p><\/p>\n<h3>P\u00ebr t\u00eb parashikuar pyetjen - pse jo Kubernetes?<\/h3>\n<p><\/p>\n<p>Duket se p\u00ebrdorimi i Kubernetes n\u00eb projekte t\u00eb vogla dhe mesme \u00ebsht\u00eb nj\u00eb overhead, t\u00eb gjith\u00eb funksionalitetin e nevojsh\u00ebm mund ta merrni nga Docker Swarm, i cili \u00ebsht\u00eb mjaft miq\u00ebsor p\u00ebr p\u00ebrdoruesit n\u00eb menaxhimin e kontejner\u00ebve, si dhe ka nj\u00eb prag t\u00eb ul\u00ebt hyrjeje.<\/p>\n<p><\/p>\n<h3>Infrastruktura<\/h3>\n<p><\/p>\n<p>Kjo e gjith\u00eb \u00ebsht\u00eb vendosur n\u00eb VDS me k\u00ebto karakteristika:<\/p>\n<p><\/p>\n<ul>\n<li>CPU: 4 b\u00ebrthama Intel&reg; Xeon&reg; Gold 5120 CPU @ 2.20GHz<\/li>\n<li>RAM: 8 GB<\/li>\n<li>SSD: 160 GB<\/li>\n<\/ul>\n<p><\/p>\n<p>Pas testimit local t\u00eb ngarkes\u00ebs, dukej se n\u00ebse ka nj\u00eb fluks t\u00eb konsideruesh\u00ebm p\u00ebrdoruesish, kjo makin\u00eb do t\u00eb ishte e mjaftueshme.<\/p>\n<p><\/p>\n<p>Por, menj\u00ebher\u00eb pas deploy-it, postova nj\u00eb lidhje n\u00eb nj\u00eb nga bordet m\u00eb t\u00eb njohura t\u00eb imazheve n\u00eb CE (po, at\u00eb vet\u00eb), dhe pas k\u00ebsaj njer\u00ebzit u interesuan dhe brenda disa or\u00ebsh, sh\u00ebrbimi p\u00ebrfundoi me sukses p\u00ebrpunimin e dhjet\u00ebra mij\u00ebra imazheve. N\u00eb momentet kulmore, burimet e CPU dhe RAM nuk u p\u00ebrdor\u00ebn as gjysm\u00eb.<\/p>\n<p>\n<img decoding=\"async\" alt=\"Kampion p\u00ebrmbledh\u00ebs i arkitektur\u00ebs s\u00eb sh\u00ebrbimit p\u00ebr vler\u00ebsimin e pamjes mbi baza t\u00eb rrjeteve neuronale\" src=\"\/wp-content\/uploads\/2020\/07\/458d74dae00d455fbce1ca6a197325d7.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<img decoding=\"async\" alt=\"Kampion p\u00ebrmbledh\u00ebs i arkitektur\u00ebs s\u00eb sh\u00ebrbimit p\u00ebr vler\u00ebsimin e pamjes mbi baza t\u00eb rrjeteve neuronale\" src=\"\/wp-content\/uploads\/2020\/07\/e9383c47369c606d26e89a69f4d22b5a.png\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<h3>Pak m\u00eb shum\u00eb grafik\u00eb<\/h3>\n<p><\/p>\n<p>Numri i p\u00ebrdoruesve unik dhe k\u00ebrkesat p\u00ebr vler\u00ebsim, nga momenti i deploy-it, n\u00eb var\u00ebsi t\u00eb dit\u00ebs<\/p>\n<p>\n<img decoding=\"async\" alt=\"Kampion p\u00ebrmbledh\u00ebs i arkitektur\u00ebs s\u00eb sh\u00ebrbimit p\u00ebr vler\u00ebsimin e pamjes mbi baza t\u00eb rrjeteve neuronale\" src=\"\/wp-content\/uploads\/2020\/07\/7112c78c8400d2ac73562243b16a015b.png\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p>Shp\u00ebrndarja e koh\u00ebs s\u00eb inferenc\u00ebs s\u00eb rafteve t\u00eb vler\u00ebsimit<\/p>\n<p>\n<img decoding=\"async\" alt=\"Kampion p\u00ebrmbledh\u00ebs i arkitektur\u00ebs s\u00eb sh\u00ebrbimit p\u00ebr vler\u00ebsimin e pamjes mbi baza t\u00eb rrjeteve neuronale\" src=\"\/wp-content\/uploads\/2020\/07\/4c892ce607c3ff3db466459729dd0876.png\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<h2>P\u00ebrfundimet<\/h2>\n<p><\/p>\n<p>P\u00ebrmbledh\u00ebsisht, mund t\u00eb them se arkitektura dhe qasja p\u00ebr orkestrimin e kontejner\u00ebve u v\u00ebrtetuan plot\u00ebsisht \u2013 edhe n\u00eb momentet kulmore nuk kishte r\u00ebnie apo ngadal\u00ebsim n\u00eb koh\u00ebn e p\u00ebrpunimit.\u00a0<\/p>\n<p><\/p>\n<p>Mendoj se projektet e vogla dhe t\u00eb mesme, q\u00eb p\u00ebrdorin inferenc\u00eb n\u00eb koh\u00eb reale me rrjete neuronale n\u00eb CPU, mund t\u00eb adoptojn\u00eb me sukses praktikat e p\u00ebrshkruara n\u00eb k\u00ebt\u00eb artikull.<\/p>\n<p><\/p>\n<p>Do t\u00eb shtoj se fillimisht artikulli ishte m\u00eb i gjat\u00eb, por q\u00eb t\u00eb mos postoj nj\u00eb tekst t\u00eb gjat\u00eb, vendosa t\u00eb shkep disa pika n\u00eb k\u00ebt\u00eb artikull \u2014 do t'i kthehemi n\u00eb publikimet e ardhshme.<\/p>\n<p><\/p>\n<p>Mund ta provosh botin n\u00eb Telegram \u2014 @AttraiBot, do t\u00eb funksionoj\u00eb s\u00eb paku deri n\u00eb fund t\u00eb vjesht\u00ebs 2020. Kujtojm\u00eb \u2014 nuk ruhen t\u00eb dh\u00ebna t\u00eb p\u00ebrdoruesve \u2014 as imazhet origjinale, as rezultatet e procesit t\u00eb vler\u00ebsimit \u2014 gjith\u00e7ka zhduket pas p\u00ebrpunimit.<\/p>\n<p>Burimi: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/511332\/\">habr.com<\/a> <\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u041f\u0440\u0438\u0432\u0435\u0442! \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u043e\u043f\u044b\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438. \u041f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u043a \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b, \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0433\u043e\u0442\u043e\u0432\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0446\u0435\u043d\u0438\u043c \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f! \u041f\u0430\u0440\u0443 \u0441\u043b\u043e\u0432 \u043e \u0437\u0430\u0434\u0430\u0447\u0435 \u0438 \u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u2013 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0444\u043e\u0442\u043e \u0434\u0430\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0443 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":89111,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-89110","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\".\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/obshhij-obzor-arhitektury-servisa-dlya-oczenki-vneshnosti-na-osnove-nejronnyh-setej\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"sq_AL\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u041e\u0431\u0449\u0438\u0439 \u043e\u0431\u0437\u043e\u0440 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0432\u043d\u0435\u0448\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439 | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\".\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/obshhij-obzor-arhitektury-servisa-dlya-oczenki-vneshnosti-na-osnove-nejronnyh-setej\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2020-07-18T17:42:10+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-07-18T17:42:10+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Pasqyr\u00eb e p\u00ebrgjithshme e arkitektur\u00ebs s\u00eb sh\u00ebrbimit p\u00ebr vler\u00ebsimin e pamjes n\u00eb baz\u00eb t\u00eb rrjeteve neuronale | ProHoster","description":".","canonical_url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/obshhij-obzor-arhitektury-servisa-dlya-oczenki-vneshnosti-na-osnove-nejronnyh-setej","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"sq_AL","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u041e\u0431\u0449\u0438\u0439 \u043e\u0431\u0437\u043e\u0440 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0432\u043d\u0435\u0448\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439 | ProHoster","og:description":".","og:url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/obshhij-obzor-arhitektury-servisa-dlya-oczenki-vneshnosti-na-osnove-nejronnyh-setej","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2020-07-18T17:42:10+00:00","article:modified_time":"2020-07-18T17:42:10+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"89110","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":null,"breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 13:16:27","updated":"2022-09-29 06:10:39","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/89110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/comments?post=89110"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/89110\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media\/89111"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media?parent=89110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/categories?post=89110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/tags?post=89110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}