<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Art Poltavsky on Medium]]></title>
        <description><![CDATA[Stories by Art Poltavsky on Medium]]></description>
        <link>https://medium.com/@artinte7?source=rss-76e8c60b7669------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*FB364M8vgPdI5CIwBC9Ddg.jpeg</url>
            <title>Stories by Art Poltavsky on Medium</title>
            <link>https://medium.com/@artinte7?source=rss-76e8c60b7669------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 15:37:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@artinte7/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Real-time object detection using YOLO upon Google Colab in 5 minutes]]></title>
            <link>https://medium.com/@artinte7/real-time-object-detection-using-yolo-upon-google-colab-in-5-minutes-fd65a4903df5?source=rss-76e8c60b7669------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd65a4903df5</guid>
            <category><![CDATA[yolo]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[google-colab]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Art Poltavsky]]></dc:creator>
            <pubDate>Sun, 08 Sep 2019 20:15:11 GMT</pubDate>
            <atom:updated>2019-09-08T20:15:11.636Z</atom:updated>
            <content:encoded><![CDATA[<p>You Only Live Once, right? Well yes but no! Not today, because we are talking about <a href="https://pjreddie.com/darknet/yolo/">You Only Look Once</a> approach in object detection that became huge.</p><p>Idea is to apply a single neural network to the full image, then divide it to various amount of regions and predict bounding boxes and probabilities for each region.</p><p>It’s okay, if you don’t exactly follow through, because my main reason is to get you curious by examples, like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*gJmQdjT3YcGCcZ2H1PK7SA.gif" /><figcaption>Traffic detection using yolov3 model</figcaption></figure><p>What if I tell you that you will be able implement YOLO object detection system in any image &amp; video you want in 5 minutes from now on and detect 80 most common objects in context? Let’s go</p><h3>Minute 1. Google Colab</h3><p><a href="https://colab.research.google.com/notebooks/welcome.ipynb">Google Colaboratory</a> is a research tool for machine learning education and research. It’s a Jupyter notebook environment that requires no setup to use and a source of free GPU for your playground models and projects. For this moment we will need to know just about that. To start along you need a Google account, which I think everybody have, but if you haven’t why did you?</p><p>Get in your google drive, then connect Colab with it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*HeXq8qJAi6Uvt2D0K3CAIw.gif" /><figcaption>connect Colab to your Drive</figcaption></figure><p>Open your “untitled.ipynb” and let’s get to work!</p><h3>Minute 2. Mount your drive, get your GPU</h3><p>If you are new to Colab and don’t know what’s jupyter notebook is, all you need to know for now, is that it’s interactive platform which helps you see the result of your code written on python immediately. To run the command simply press <em>“Shift+Enter”</em></p><pre>from google.colab import drive<br>drive.mount(&#39;/content/gdrive&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*qS-HooElKhY37zBEugGilA.png" /></figure><p>Just that simple! Now, let’s get our GPU</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*PxyugrdGba2fX9t7S4Dxzg.gif" /></figure><h3>Minute 3. Install YOLO and all the dependencies</h3><p>I encourage you to type code by yourself to get familiar with it, but you can also check <a href="https://colab.research.google.com/drive/1ujJ9IV_64mq6VBuNkywUMCU_y7lHtqHD">this notebook</a>, which contains exactly what we need for now</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*gdFfuaHwAQAF91X3ZNG-fQ.png" /><figcaption>make sure you use Tesla K80 GPU (12GB), by changing ‘runtmie type’, to check it type:<br>!nvidia-smi</figcaption></figure><p>The following steps are extremely simple:<br> — clone darknet repository and add path for cuda</p><pre>import os<br>os.environ[&#39;PATH&#39;] += &#39;:/usr/local/cuda/bin&#39;<br>!git clone <a href="https://github.com/AlexeyAB/darknet/">https://github.com/AlexeyAB/darknet/</a></pre><p>this step might be optional, but better be executed</p><pre>!apt install gcc-5 g++-5 -y<br>!ln -s /usr/bin/gcc-5 /usr/local/cuda/bin/gcc <br>!ln -s /usr/bin/g++-5 /usr/local/cuda/bin/g++</pre><p>— go to the darknet folder, enable GPU and OpenCV support, then compile the entire thing</p><pre>cd darknet<br>!sed -i ‘s/GPU=0/GPU=1/g’ Makefile<br>!sed -i ‘s/OPENCV=0/OPENCV=1/g’ Makefile<br>!make</pre><p>— get yolov3 weights, which is great balance between accuracy and speed, also make darknet executable</p><pre>!wget <a href="https://pjreddie.com/media/files/yolov3.weights">https://pjreddie.com/media/files/yolov3.weights</a><br>!chmod a+x ./darknet</pre><p>That’s it! Now we are ready for the fun part</p><p>(if fun part don’t works for you by any reason, go to my <a href="https://colab.research.google.com/drive/1ujJ9IV_64mq6VBuNkywUMCU_y7lHtqHD">notebook</a>, there is also code for image detections)</p><h3>Minute 4. Upload video, get result, play result</h3><p>There is a bunch of ways to get video in your session, and one of the simplest is this:</p><pre>from google.colab import files<br>uploaded = files.upload()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*70TOrmE4SdXvoE2N67CWzw.png" /><figcaption>upload short video for detection</figcaption></figure><p>As the uploading process is finished, check the path you located, it must be ‘darknet’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/157/1*8__kSXYP-Gdjl9I_ijn_QQ.png" /></figure><p>Now be careful, darknet seems to crash if you provide wrong type of output file extension (<em>non .avi</em>), the syntax should be exact the same</p><p><em>doggy.mp4</em> is file you provide, and <em>whatever-you-want.avi</em> is what you get:</p><pre>!./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights -dont_show doggy.mp4 -i 0 -out_filename out.avi</pre><blockquote>Download the output and enjoy yourself!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*lvo1m56aFGdrpo9cd6TDag.gif" /></figure><h3>Minute 5. What did just happened?</h3><p>You got (almost) immediate result without knowing all the ‘magic’ beneath it. Will it be better if I show you what’s behind the hood of YOLO right now?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*khfr38a54axPdtP3t9aVtg.png" /></figure><p>With proper understanding, it might be as enjoyable as looking into those slow-mo doggy videos, and we get to it with a strong base knowledge</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*ISWR-slht06XB2DdpgWcSg.gif" /></figure><p>But for now, 5 minutes is over as our gentle introduction to Object Detection using CNN</p><p>Detection goes hand by hand with tracking, topic I consider next to write about with both shallow and deeper level of immersion</p><p>Stay tuned and enjoy the height</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j9EIoZ_95jL4y5m9YbVixA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd65a4903df5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Парсим aviasales вместе с python, часть 1: Сущность, инструменты, proxy]]></title>
            <link>https://medium.com/@artinte7/%D0%BF%D0%B0%D1%80%D1%81%D0%B8%D0%BC-aviasales-%D0%B2%D0%BC%D0%B5%D1%81%D1%82%D0%B5-%D1%81-python-%D1%87%D0%B0%D1%81%D1%82%D1%8C-1-%D1%81%D1%83%D1%89%D0%BD%D0%BE%D1%81%D1%82%D1%8C-%D0%B8%D0%BD%D1%81%D1%82%D1%80%D1%83%D0%BC%D0%B5%D0%BD%D1%82%D1%8B-proxy-ad8d615dcb49?source=rss-76e8c60b7669------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad8d615dcb49</guid>
            <category><![CDATA[программирование]]></category>
            <category><![CDATA[parsing]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[beautifulsoup]]></category>
            <dc:creator><![CDATA[Art Poltavsky]]></dc:creator>
            <pubDate>Sun, 02 Jun 2019 19:38:50 GMT</pubDate>
            <atom:updated>2019-06-02T19:38:50.840Z</atom:updated>
            <content:encoded><![CDATA[<p>Сегодня мы поговорим о такой тонкой материи, как автоматический сбор информации на примере поисковика дешевых авиабилетов aviasales.ru</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*adHfqmYSTWaYx-f6P_e-Dw.png" /><figcaption>стартовый экран aviasales.ru</figcaption></figure><p>Стоит заметить, что автоматизированный сбор информации проводился при <strong>соблюдении</strong> следующих условий, и должен всегда оставаться таковым:</p><ul><li>Информация находится в открытом доступе и не защищается законодательством об авторских и смежных правах.</li><li>Автоматизированный сбор осуществляется законными способами.</li><li>Автоматизированный сбор информации не приводит к нарушению в работе сайтов в сети интернет.</li><li>Автоматизированный сбор информации не приводит к ограничению конкуренции.</li><li>Парсер не извлекает личную информацию пользователя</li></ul><p>Парсить поисковик, словно парсить парсер — защита в таких сервисах будет на порядок строже, поэтому пристегните ремни, мы взлетаем!</p><h3>Инструменты</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*-KnmHrVD0paCtVWF.jpg" /><figcaption>Типичный набор инструментов</figcaption></figure><ol><li>Python (питон) версии 3.x — быстрое прототипирование, внушающее количество библиотек, удобство в использовании</li><li>Pandas — библиотека для работы с данными, умеет многое, ускоряется с помощью</li><li>Numpy — библиотека для быстрой работы с большими массивами данных. Расширяет функционал питоновских списков, внедряя множество полезных функций</li><li>Beautifulsoup &amp; requests — шустрые и удобные инструменты для получения html содержимого страниц и выделения в них конкретных данных и нужных значений</li><li>Selenium — темная лошадка, создающая агентов, основная задача которых — эмулировать обычную сессию браузера и выполнять “человеческие” действия. Изначально предназначена для тестирования работоспособности сайтов и веб-приложений</li><li>Proxy — плащ-невидимка наших агентов. Основная функция — предотвращать блокировку парсера, путем изменения IP адреса, с которого приходит запрос</li></ol><h3>План действий</h3><ol><li><strong>Получение бесплатных IP от прокси серверов</strong></li><li>Создание агента и эмулирование сессии браузера</li><li>Сбор нужной информации на сайте</li><li>Сохранение и представление информации в нужном виде</li></ol><h3>Первые шаги. Forewarned is forearmed</h3><blockquote><strong>Прокси-сервер</strong> — промежуточный сервер, выполняющий роль посредника между пользователем и целевым сервером (при этом о посредничестве могут как знать, так и не знать обе стороны), позволяющий <a href="https://ru.wikipedia.org/wiki/%D0%9A%D0%BB%D0%B8%D0%B5%D0%BD%D1%82_(%D0%B8%D0%BD%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D0%B0)">клиентам</a> как выполнять косвенные запросы к другим сетевым службам, так и получать ответы. Сначала клиент подключается к прокси-серверу и запрашивает какой-либо ресурс (например, <a href="https://ru.wikipedia.org/wiki/E-mail">e-mail</a>). Затем прокси-сервер либо подключается к указанному серверу и получает ресурс у него. В некоторых случаях запрос клиента или ответ сервера может быть изменён прокси-сервером в определённых целях.</blockquote><p>Находим понравившийся сайт с бесплатными proxy серверами в google, заносим его url в одноименную переменную</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3u1eNkgvFxiwl5XswxmjSQ.png" /><figcaption>Данные легко спарсить из <a href="http://foxtools.ru/Proxy">http://foxtools.ru/Proxy</a></figcaption></figure><p>И вперед, практиковаться в веб-скраппинге:</p><pre>import requests<br>from bs4 import BeautifulSoup</pre><pre>def get_proxy_ip(url):<br>        ...<br>url = &quot;http://foxtools.ru/Proxy&quot;<br>get_proxy_ip(url)</pre><p>Напишем объявленную функцию:</p><pre>def get_proxy_ip(url):<br>    <strong>r = requests.get(url)<br>    html = r.content<br>    soup = BeautifulSoup(html, &#39;lxml&#39;)</strong><br>    ip_list = soup.find_all(&quot;input&quot;, class_=&quot;ch&quot;)<br>    for i in range(0, len(ip_list)):<br>        ip_list[i] = ip_list[i][&#39;value&#39;]<br>    return ip_list</pre><p>Библиотека requests отправляет запрос по заданному url и получает много всего интересного, из чего нас интересует html содержимое</p><p>Объявляем переменную soup и читаем наш html. Далее следует метод “проб и ошибок” по выделению нужной информации из всей страницы. Легко проникнуть к нужному элементу можно нажав на нем правую кнопку мыши и выбрав действие “Inspect Element(Q)” (firefox):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/0*0RF-Vt2Gr38WqFS2.jpg" /></figure><p>Из консоли браузера мы успешно находим элемент, отвечающий нашим требованиям</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*zhBY0QiJIo5PN2e5QKzTIw.png" /><figcaption>нужный элемент</figcaption></figure><p>Нам остается лишь выделить в нем нужные значения (в данном случае value):</p><pre>&lt;input class=”ch” onclick=”SelectProxy(this)” type=”checkbox” value=”218.202.219.81:80&quot;/&gt;<br>&lt;input class=”ch” onclick=”SelectProxy(this)” type=”checkbox” value=”61.135.217.23:80&quot;/&gt;<br>&lt;input class=”ch” onclick=”SelectProxy(this)” type=”checkbox” value=”61.135.217.21:80&quot;/&gt;</pre><p>Что успешно и делают следующие строки кода.</p><pre>def get_proxy_ip(url):<br>    r = requests.get(url)<br>    html = r.content<br>    soup = BeautifulSoup(html, &#39;lxml&#39;)<br>    <strong>ip_list = soup.find_all(&quot;input&quot;, class_=&quot;ch&quot;)<br>    for i in range(0, len(ip_list)):<br>        ip_list[i] = ip_list[i][&#39;value&#39;]</strong><br>    return ip_list</pre><p>Дабы не объявлять список второй раз, просто перезаписываем информацию и возвращаем его.</p><p>Все! Теперь у нас есть список работающих прокси серверов, которые позволят нашим агентам посылать неограниченное количество запросов с разных точек планеты, оставаясь неуязвимыми</p><p>Если некоторые части данной статьи вызывают отсутствие понимания/ваши данные не парсятся таким способом, рекомендую ознакомиться с <a href="https://www.crummy.com/software/BeautifulSoup/bs4/doc/">документацией Beautiful Soup</a> и не забывайте про <a href="https://stackoverflow.com/search">StackOverflow</a></p><p>Во второй части, приступим к написанию парсера для aviasales, разберем его защиту по кирпичикам с помощью selenium, научимся представлять и сохранять полученные данные в нужном нам виде</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*THkF1CWO8wMO_upr.jpg" /><figcaption>Увидимся!</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad8d615dcb49" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>