<?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 Apdullah Yayik on Medium]]></title>
        <description><![CDATA[Stories by Apdullah Yayik on Medium]]></description>
        <link>https://medium.com/@apdullahyayik?source=rss-31566dbf5c52------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*bH389MfqQccBHI4RY5v2Tw.jpeg</url>
            <title>Stories by Apdullah Yayik on Medium</title>
            <link>https://medium.com/@apdullahyayik?source=rss-31566dbf5c52------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 09:53:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@apdullahyayik/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[Efficient Reading to Benefit from Research Articles]]></title>
            <link>https://apdullahyayik.medium.com/efficient-reading-to-benefit-from-research-articles-857d9e7622f3?source=rss-31566dbf5c52------2</link>
            <guid isPermaLink="false">https://medium.com/p/857d9e7622f3</guid>
            <category><![CDATA[how-to-research]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[reading]]></category>
            <category><![CDATA[academic-research]]></category>
            <dc:creator><![CDATA[Apdullah Yayik]]></dc:creator>
            <pubDate>Sat, 10 Apr 2021 17:11:23 GMT</pubDate>
            <atom:updated>2021-04-10T17:34:15.339Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, I will write some keynotes for researchers to be able to read and evaluate an academic paper and how to reflect smoothly the innovations in the industry.</p><blockquote>“There’s no discovery without a search and there’s no rediscovery without a research. Every discovery man ever made has always been concealed. It takes searchers and researchers to unveil them, that’s what make an insightful leader” <strong>Benjamin Suulola</strong></blockquote><p>First of all, reading a research paper about a topic for which you have not read a coursebook before means expecting benefit by watching only the end of a movie that you haven’t watched in the beginning. Besides not being selective and trying to read every single paper in detail leads to be exposed to unnecessary and/or noisy information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*6zLgOHUCF3cMG4Kn80gzAw.jpeg" /></figure><p>First and foremost, the requirement for a publication worth reading is to make sure that it is highly indexed or written by qualified people. For example in my field of research, such indexes are SCI (science citation index) or SCI-E (science citation index-expanded) are evaluated as worth reading. You don’t have to get stuck about the word “expanded ‘’ as it is not a definition designed to include low-quality ones. In the last 5 years, researchers in particular in the industry think that the earnings of publishing houses are unfair and have released their works as “preprint” through <a href="https://arxiv.org/">arXiv</a> and <a href="https://www.biorxiv.org/">bioXriv</a>. This situation requires you to have the ability to search and find high-academic content in these environments. For instance, you can better follow the latest trends in machine learning, which is my research area, from <a href="https://arxiv.org/">arXiv</a>.</p><p>When you encounter a paper, it is not possible to read it completely. At this point, a very efficient and useful technique named “three-pass reading” comes into play. So, what is three-pass reading? Let me clarify the theory and how I implement it.</p><p>As the name suggests, it consists of three stages. In the following paragraphs, they are given one by one.</p><p>The first stage is a quick scan of the paper likely a bird’s eye view. First, read the title, try to understand whether there is a brand new invention claim or whether a new problem is solved with the existing ones. Then read the abstract section and inquire whether it relates to the title. Then read the conclusion section and try to understand how much it fits with the abstract section. If you notice a discrepancy between these or the use of broken language syntax, you can stop reading for this paper at this point. If not, only read the titles of the sub-sections as well as a glance at the references whether to know any paper you have already read (maybe your paper) has been cited, now you are ready for the second stage. At the end of this stage, you need to decide on whether to switch to the following stage. My advice is that you should be able to eliminate 90% of the papers you come across at this stage.</p><p>The second stage should last at least 30 minutes. You should check whether the flow diagram of the prosed system and the content of the publication are aligned, the pixel quality of the figure together with its axes titles, whether the equations are in accordance with the given notation, and whether the digits in the tables are an averaged value of something with kindly provided standard errors. At this stage, there is no need to read the work with all its details. However, you must have been familiar with the academic presentation of the research as well as the results. At the end of this stage, you should decide that whether this paper is beneficial for you or not. If not, from that moment on you should stop reading the paper. My advice is that you should be able to eliminate 7% of the papers you come across at this stage.</p><p>The papers you focus on at each stage should decrease like a decrease in the rise of the pyramid. You need to evaluate the results obtained by coding the proposed methods in your mind. You should also build bridges with the paper by first running then reviewing the source codes shared by the authors. Finally, at this stage, you should determine the reference work that the authors are mostly inspired by and continue your research process through this reference study.</p><p>In this article, I tried to convey several accepted effective article reading techniques by combining them with my own experience. I hope it will be useful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=857d9e7622f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[End-To-End Text Classification with BERTurk]]></title>
            <link>https://apdullahyayik.medium.com/end-to-end-text-classification-with-berturk-a859d64aa265?source=rss-31566dbf5c52------2</link>
            <guid isPermaLink="false">https://medium.com/p/a859d64aa265</guid>
            <category><![CDATA[bert]]></category>
            <category><![CDATA[transformers]]></category>
            <category><![CDATA[natural-language-processi]]></category>
            <category><![CDATA[turkish-language]]></category>
            <category><![CDATA[berturk]]></category>
            <dc:creator><![CDATA[Apdullah Yayik]]></dc:creator>
            <pubDate>Mon, 15 Mar 2021 10:40:08 GMT</pubDate>
            <atom:updated>2021-03-15T10:40:08.303Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Brief Introduction</h3><p>The transformer-based machine learning models have led to substantial gains on several complex natural language processing (NLP) tasks. In this article, I will make a basic theoretical introduction to the architectural design of the transformer models and text classification that is a popular downstream task. Then I will show you the fine-tuning operation of the pre-trained (nowadays this term is changed with self-supervised) <a href="https://github.com/stefan-it/turkish-bert">BERTurk</a> model using <a href="https://github.com/huggingface/transformers">transformers</a> library provided by <a href="https://huggingface.co/">Hugging Face</a> for the text classification task.</p><p>Text classification, also known as text categorization, is a classical downstream task in natural language processing (NLP), which intends to specify labels or tags to textual segments such as sentences, questions, paragraphs, and documents. It has a broad range of utilization consisting of question answering, spam detection, sentiment analysis, news categorization, user intent classification, content moderation, etc. Text data can be obtained from various sources, including web data, emails, chats, social media, tickets, insurance claims, user reviews, and questions and answers from customer services, to name a few. Text is a remarkably rich source of information. But obtaining insights from a text can be challenging and time-consuming, due to its unstructured and ambiguous characteristics.</p><p>The text classification operation is only achievable by the discovery of nonlinear relationships between words. Note that it is prone to error if the conventional methods such as TF-IDF vectors are employed.</p><h3><strong>What is Transformer Models?</strong></h3><p>I will not provide details about the architecture of the transformer models in this article (I promise for a dedicated article shortly). But it is beneficial to understand some of the difficulties in computational linguistics. There are two primary strategies, which are interconnected, (1) word embedding, (2) language model. Transformer models are dedicated to creating language models. As for word embeddings, they can be obtained via neural-based (CBOV, skip-gram) or probabilistic (WordPiece) approaches. Also, this side is not the focus of this article.</p><h3>Have LSTM Models Been Invalid?</h3><p>Most old-fashioned techniques for language modeling rely on recurrent neural networks (RNNs). RNNs have a fundamental problem that is based on the vanishing gradient<strong> </strong>and therefore fails to model the longer contextual dependencies. They were essentially displaced by the long short-term neural networks (LSTMs) that are also a special kind of RNN but can catch the larger contextual dependencies. But LSTM can process sequences only unidirectional, for this reason, they are replaced with the bidirectional LSTMs (Bi-LSTMs), which can process the sequences not only left to right but also right to left. Some very promising models rely on LSTMs, i.e., <a href="https://allennlp.org/elmo">ELMO</a>, <a href="https://arxiv.org/abs/1801.06146">ULMFiT</a>. Furthermore, such models are still confirmed by the modern NLP community.</p><p>However, Bi- LSTMs have limitations to train in parallel due to their sequential architecture. With the attention layers, transformers have solved this issue and it is relatively much cost-effective to train in parallel. A large corpus can be pre-trained unsupervised to be able to be fine-tuned on any downstream task.</p><h3>State-of-the-art Transforms Models</h3><p>Researchers in academics and industry have introduced many variants of transformer-based models for the last 3 years. As of March 2021, the most successful ones are listed below:</p><p><a href="https://www.cs.ubc.ca/~amuham01/LING530/papers/radford2018improving.pdf">GPT</a> (Generative Pre-Training)</p><p><a href="https://arxiv.org/abs/1810.04805">BERT </a>(Bidirectional Encoder Representations from Transformers)</p><p><a href="https://arxiv.org/abs/1909.11942">ALBERT</a></p><p><a href="https://arxiv.org/abs/2005.14165">GPT-3</a></p><p><a href="https://arxiv.org/abs/1906.08237">XLnet</a></p><p><a href="https://arxiv.org/abs/2003.10555">ELECTRA</a></p><p><a href="https://arxiv.org/abs/2006.16668">GShard</a></p><p>For now, there are small differences among the models. BERT is regarded as a state-of-the-art one on several NLP tasks. For representation, in this article, I will make practices with the BERTurk-based model.</p><h3>BERT</h3><p><a href="https://arxiv.org/abs/1810.04805">BERT</a> is a machine learning model that utilizes the pre-training of a language model. BERT has two forms: based and large. In this paper, the BERT-based model is explained. The details of the BERT-based model are out of the scope of this article. The model consists of 12 transformer blocks, 12 attention heads, and 768 hidden sizes. Besides, it has almost 110M pre-trained weights.</p><p>Pre-training of the BERT model is applied by optimizing 2 loss functions: (1) select randomly 15 \% of the word embeddings in the content and label them as unknown, then forecast the weights to reach the original word embeddings (this task is called Masked Language Model), (2) forecast connected sentences in the textual content. The architectural design of creating word embeddings in the BERT model is shown in the Figure below.</p><figure><img alt="BERT input representation, by Delvin et.al (https://arxiv.org/pdf/1810.04805.pdf)" src="https://cdn-images-1.medium.com/max/1024/1*a83hUcOKgDNpTvzPd5ZsCw.png" /><figcaption>BERT input representation, by Delvin et.al (Figure 2 at https://arxiv.org/pdf/1810.04805.pdf)</figcaption></figure><p>As it is seen in the Figure, word embeddings are calculated by summing of the (1) segmentation embeddings that keep the order of the sentence, position embeddings that keep the order of the subwords, and token embeddings via <a href="https://arxiv.org/abs/1609.08144">WordPiece</a> model which regards the probability of the subwords.</p><p>There 2 special tokens: [CLS] and [SEP] tokens. The [CLS] token is added at the onset of each sequence, while the [SEP] token is added at the end.</p><p>Contrary to the pre-training task, in the fine-tuning task, all weights are end-to-end updated in a relatively cheaper way.</p><h3>BERTurk</h3><p><a href="https://github.com/stefan-it/turkish-bert">BERTurk</a> is a community-driven BERT model for the Turkish language. Pre-training of it is employed via a large Turkish corpus. It outperforms the official BERT model on Turkish NER tagging. In this article, for illustration, I will use the BERTurk model.</p><p>Let’s start coding!</p><h3>Install Dependencies</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69d4747da4ca310be142490a11c6e69f/href">https://medium.com/media/69d4747da4ca310be142490a11c6e69f/href</a></iframe><h3>Import Libraries</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa0302949bbd92c6118b3dc55d81c9b3/href">https://medium.com/media/fa0302949bbd92c6118b3dc55d81c9b3/href</a></iframe><h3>Check GPU</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d437807222d9009dbb871e630519d2c7/href">https://medium.com/media/d437807222d9009dbb871e630519d2c7/href</a></iframe><p>You can see the details through “nvidia-smi” command from the terminal.</p><h3>Read Data</h3><p>Content of train.data and test.data files should be like below:</p><p>category, text<br>politics, siyaset,ön seçim vaadi mhp nin olağan büyük kurultayı<br>health, sıra dışı ağrı hastalık habercisi normal ağrı kesicilerin<br>justice, suçluluğu sabit oluncaya suçlu sayılamaz<br>religion, isa mesihin döneceğine gelişe inançta birleşmişlerdi</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5fb79d0f205d45aac4b2e087151cb6d4/href">https://medium.com/media/5fb79d0f205d45aac4b2e087151cb6d4/href</a></iframe><h3>Preprocessing</h3><p>Stop-words, punctuation and number removal, and case-folding to lower case. These codes can be used if preprocessing is required in your case.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/107a6c5bca43bc3a753ffa25ffface58/href">https://medium.com/media/107a6c5bca43bc3a753ffa25ffface58/href</a></iframe><h3>Encode Labels</h3><p>Making labels numeric values.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bdfe4fa73b0ee8625a52afe2d473d1dd/href">https://medium.com/media/bdfe4fa73b0ee8625a52afe2d473d1dd/href</a></iframe><h3>BERTurk Tokenization</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d4b77d183655a16ad06280a720952ba/href">https://medium.com/media/7d4b77d183655a16ad06280a720952ba/href</a></iframe><h3>Encode Data</h3><p>Input tokenization that is described in Figure 2 by <a href="https://arxiv.org/abs/1810.04805">Devlin et.al.</a> WordPiece mapping and inserting special tokens.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3803e0cfdf778381a55838987b952d18/href">https://medium.com/media/3803e0cfdf778381a55838987b952d18/href</a></iframe><p>Apply the encoding to train and test sets.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5e7a2de65eac3e3d8e5683cc55ab7a0/href">https://medium.com/media/e5e7a2de65eac3e3d8e5683cc55ab7a0/href</a></iframe><h3>Build Model</h3><p>Set Learning Parameters</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca4efef5172288a55f8546a2aab58446/href">https://medium.com/media/ca4efef5172288a55f8546a2aab58446/href</a></iframe><p>Create Model</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e409942349532342c2fb98bf173971f8/href">https://medium.com/media/e409942349532342c2fb98bf173971f8/href</a></iframe><h3>Model Architect</h3><p>As it is seen the BERTurk-based model has almost 109M parameters (a little less than BERT-based).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*aK9Bhl5nM8-4z2PQva_Zrg.png" /></figure><h3>Train Model</h3><p>Model training takes 6 hours 15 minutes 32 sec and requires at least 9 GB memory with GPU Nvidia Tesla V4.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/afb4808d6f3a55a3fb51bce4913195e6/href">https://medium.com/media/afb4808d6f3a55a3fb51bce4913195e6/href</a></iframe><p>During training for <strong>both</strong> the train and validation sets, loss value is decreased and accuracy is increased. This means the model has learned in the scope of the train set. Model files are saved at each epoch. The disk size of the models is 442 MB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GSTIMzwUtpuvJU49R4V_bg.png" /></figure><h3>Model Serve</h3><p>Import Libraries</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0634552b29b5a1dfed5640c4d3fef2fa/href">https://medium.com/media/0634552b29b5a1dfed5640c4d3fef2fa/href</a></iframe><p>Load Model</p><p>When the model is loaded, it consumes 1.1 GB of memory.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/583b951ccbe7966c300bfaa28331c2b0/href">https://medium.com/media/583b951ccbe7966c300bfaa28331c2b0/href</a></iframe><p>BERTurk Tokenization</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d4b77d183655a16ad06280a720952ba/href">https://medium.com/media/7d4b77d183655a16ad06280a720952ba/href</a></iframe><p>Given text:</p><pre>text = <strong>&quot;&quot;&quot;<br>Botosani son haftaların flaş ekibi… Şampiyonluk adayı Cluj’u da 2-1’le geçerek son 6 maçta 5. galibiyetlerini elde ettiler. Ay başında teknik adam değişikliğine giden Gaz Metan son yıllarda olmadığı kadar iyi sonuçlar aldı bu aralar. Son olarak Chindia’yı 1-0 mağlup ettiler. Formda iki takım karşılaşıyor, beraberlik öne çıksa da karşılıklı gol daha sağlam bir seçim.<br>&quot;&quot;&quot;</strong></pre><p>Preprocess and Encode the given text</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d85eadd71660537d310abcb1f91c5899/href">https://medium.com/media/d85eadd71660537d310abcb1f91c5899/href</a></iframe><p>Send tokens to the model</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e22fdadce25efe41cc50612020a3250/href">https://medium.com/media/4e22fdadce25efe41cc50612020a3250/href</a></iframe><p>Add a Softmax Layer</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7227a73c373a1efca1da24d38ad52437/href">https://medium.com/media/7227a73c373a1efca1da24d38ad52437/href</a></iframe><p>Get the decision that has the highest probability</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d9f54646221e41ba331f4eba1999401/href">https://medium.com/media/5d9f54646221e41ba331f4eba1999401/href</a></iframe><h3>Conclusion</h3><p>We have formed end-to-end operations to employ transformers on the text classification task. The operations can be adapted to any other NLP downstream tasks with merely minor adjustments to the code. Codes are shared as a <a href="https://colab.research.google.com/drive/1DZ5T4Ieog2q1-SRV-UNU2qvsECT-gxBj?authuser=1#scrollTo=ZxHUw5JgdG1H">Colab project</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a859d64aa265" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object Detection & Segmentation with Python]]></title>
            <link>https://apdullahyayik.medium.com/mask-rcnn-object-recognition-and-segmentation-with-colab-application-cd0b5e490130?source=rss-31566dbf5c52------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd0b5e490130</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[resnet]]></category>
            <category><![CDATA[mask-rcnn]]></category>
            <category><![CDATA[resnet50]]></category>
            <dc:creator><![CDATA[Apdullah Yayik]]></dc:creator>
            <pubDate>Tue, 27 Aug 2019 09:29:20 GMT</pubDate>
            <atom:updated>2019-08-27T10:07:52.369Z</atom:updated>
            <content:encoded><![CDATA[<p>It was announced by FAIR (facebook artificial intelligence research) last year that the Mask RCNN structure using the <a href="https://arxiv.org/abs/1512.03385">resnet50</a> infrastructure was successfully implemented on MS COCO and Balloon datasets and valuable resuts were obtained (see dedicated <a href="https://github.com/matterport/Mask_RCNN">github page</a>). In addition, the trained weights were also released for researchers and practitionars to make transfer learning to solve different problems with reasonable cost(see <a href="https://github.com/matterport/Mask_RCNN/releases">matterport github page</a>).</p><p>In my another article I have explaineed how to make transfer learning with such released MS COCO weights to deletect an locate weapons (see article here)</p><p>At the end of this reading this article, you will see succesful object recognition and segmentation in video and images taken randomly from the outerside of the world.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FKoOxnYbQV4o%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DKoOxnYbQV4o&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FKoOxnYbQV4o%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9d6e7e48a4958cd264f0c0df5e98363e/href">https://medium.com/media/9d6e7e48a4958cd264f0c0df5e98363e/href</a></iframe><p>It will be a quicker and easier way to run python codes on Google Colab, where the required packages are already available. In this sense, you can review and execute <a href="https://colab.research.google.com/drive/1NT5InAljpJroLBW44TObneislSnQmyz5#scrollTo=3IEVK-KFxi5Z">my notebook on Colab</a>.</p><p>If you need to run on your local computer consider the required packages below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/224/1*I8rwx0ttIVBKEnBwPxrk4A.png" /><figcaption>required packages</figcaption></figure><p>Install cython and Python API for MS COCO data. These will be used at prepocessing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*mHk9cxiwwzrw3sJoYG9wYA.png" /></figure><p>You can clone Mask RCNN python code from matterport page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*LG4UYC0uE6KgKyRU08Ezqg.png" /></figure><p>Do not forget to add mrcnn folder that contains configurations and coco folder to python path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*14b2WP9wVLa67fmAKD5eaA.png" /></figure><p>Import libraries and assign values for needed directories. Note that, here in “logs”folder optimized weights are saved in .h5 format with corresponding time stamp after each epoch while training. In this application weights released by matterport (COCO_MODEL_PATH) will be used so this folder will not used. Also “image” folder contains images for testing, we will not use it to see results from any image from anywhere.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*DmSPyPSLMrJvChEk5tG5nQ.png" /></figure><p>Configuration of dataset loading, augmentation, prediction and, masking choises of test images can be made in this code. The utmost important parameters for learning can be changed in base configuration class ‘Config’ that is in /mrcnn/config.py file.</p><p>‘config’ object inhereted from ‘InterferenceConfig’ class takes parmeters from ‘CocoConfig’ class in coco.py file and overrides for your choice.</p><p>We will use the parameteres that were used while training to able to make accurate feedforward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*32YMkAvGNbSBP9EWAhcsOw.png" /></figure><p>Here model is created with considering configuration above, architecture of resnet50 is structured using Tensorflow and Keras libraries (Note that modellib is alias model library of /mrcnn/model.py) Then weights are loaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*7W48xMKcT6rPSymSY2EnsA.png" /></figure><p>MS COCO dataset has 81 number of classes. In which language you want the masking to be made, you can change them without breaking the order.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*s7xi_8_iTlbYGZjEyBoqdA.png" /></figure><p>And, we are coming to end for image masking. Read image and predict.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/1*7zELWtxOMFz6srGiZwCoEg.png" /></figure><p>I provide some gorgeus photos masked with Mask RCNN.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*LxTAfeA9k29u7eMrRKgi3g.png" /><figcaption>Central Square, Iskenderun, Turkey</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*bgRf4q4LX1a2S8G6Yg0OvQ.png" /><figcaption>Eymir Lake, Ankara Turkey</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*m8V3OFnx20T2t_NZiLy6fg.png" /><figcaption>Eymir Lake, Ankara, Turkey (left: me)</figcaption></figure><p>Now, lets make a video example. Start by cloning a sample video from github page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*oCf834G7TrfrTvElWJwEJw.png" /></figure><p>Each frame in the video is being processed in the same way just here, see the whole code in <a href="https://colab.research.google.com/drive/1NT5InAljpJroLBW44TObneislSnQmyz5#scrollTo=QSxgxJGyGBuf">my colab notebook</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*gwFUCVm-JtzSyAPobo6EjQ.png" /></figure><p>You can check the number of listed masked frames to verify the accuracy of the process above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*i38Wqcp51EsaK9UEdRPeqA.png" /></figure><p>Masked frames can be combined to make masked video using the make_frame method with this python code:</p><p><strong>make_video(outvid, images, fps=30)</strong></p><p>Congrats! You can check and download masked video in ‘mytestimagesvideos’ folder.</p><p><strong>!ls ./mytestimagesvideos</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd0b5e490130" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>