<?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 ai-dlp on Medium]]></title>
        <description><![CDATA[Stories by ai-dlp on Medium]]></description>
        <link>https://medium.com/@aidlp20180201?source=rss-d934ad0d2e00------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*S-R7lg_cTk7BcbnCWZ4SRA.jpeg</url>
            <title>Stories by ai-dlp on Medium</title>
            <link>https://medium.com/@aidlp20180201?source=rss-d934ad0d2e00------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 12:19:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aidlp20180201/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[Using Custom Python Layers In Your Caffe Models With DLP]]></title>
            <link>https://medium.com/@aidlp20180201/using-custom-python-layers-in-your-caffe-models-with-dlp-1f40f876639f?source=rss-d934ad0d2e00------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f40f876639f</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python-layer]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[caffe]]></category>
            <dc:creator><![CDATA[ai-dlp]]></dc:creator>
            <pubDate>Thu, 31 Jan 2019 12:28:09 GMT</pubDate>
            <atom:updated>2019-01-31T12:28:09.066Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In Caffe, the python layer gives users the ability to add custom layers to their network without modifying Caffe’s core code. This comes in handy if you want to implement a functionality that is not available in Caffe.</p><p>This tutorial will walk you through the process of creating a custom python layer and show you how to add it in your network definition. By the end of this tutorial, you will be comfortable to get started with python layers in DLP (<strong>version 2.5.1 or later</strong>).</p><h3>How To Implement A Python Layer?</h3><p>You should build your custom python layer as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WGkCn1TZu9ulgzgEM3Crbw.png" /><figcaption>Python Layer Template</figcaption></figure><p>Here are the key points to remember:</p><p>1- Your custom layer must be implemented as a python class and has to inherit from <strong>caffe.Layer;</strong></p><p>2- You must define the following four methods: <strong>setup, reshape, forward, backward;</strong></p><p>3- All methods have a <em>bottom</em> and a <em>top</em> parameters, which are the blobs that store the input data in the layer and the output data from the layer.</p><h3>Use Case: Creating A Custom Layer For Your Binary Classification Predictions</h3><h4>Designing A Python “metrics” Layer</h4><p>In this example, we will design a “metric” layer. This layer will output the accuracy and a confusion matrix of the model during training, and the accuracy, precision, recall, and f1-score of the model during validation/testing.</p><p>Here is my custom layer implementation named <a href="https://1drv.ms/u/s!AvA6mP_ngpmvdaorKpS1iiWDmOo"><em>binaryMetricsLayer.py</em></a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KvIA3esjIKtL4eM1xcoOSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FniO0-1-lOOFloyjbhDCHg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zivlSKHXgXyZh2rsof3qvw.png" /></figure><p>Here are the key points to remember:</p><p>1- The order of the bottom blobs, which are the input to the layer, is of great importance and need to be remembered as it will guide the way we define those layer in DLP. In the code above, we have assumed the model’s predicted outputs to be the first bottom blob and the ground truth labels the second.</p><p>2- Likewise we should take note of the order of the top blobs, which are the output of the layer.</p><p>3- We have “technically” defined two custom python layer. One that will compute the model’s accuracy and confusion matrix during the train phase, and the other that will output the model’s accuracy, precision, recall and f1-score during the test phase.</p><p>Now that we’ve designed a custom python “metric” layer for binary classification tasks, let us see how we define it in DLP.</p><p>Fire up DLP and select <strong>Image</strong> for data type and <strong>Classification</strong> for the type of model you want to build. Click continue, then select the <strong>Net</strong> tab. Next, define your working directory and pull out the docker container.</p><blockquote>If you are new to <strong>DLP</strong>, please visit our <a href="http://www.ai-dlp.com/">website</a> and get your copy of DLP for free. Then, before you get started, we strongly recommend that you go through our <a href="https://medium.com/@aidlp20180201/building-your-own-object-detector-model-using-fasterrcnn-in-dlp-3e1bc5ada64b">lastest post</a>, specifically the <strong>Before You Get Started </strong>section, which will guide you through the process of setting up your machine so that you can take advantage of DLP’s docker-based development environment.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XWq8ZTvwGUIf8ckdGz8Jvg.png" /></figure><p>We will use AlexNet from DLP network library to show how to incorporate our custom python layers into the network architecture. So drag and drop Alexnet net into the visualization area and remove the Caffe Accuracy layer since we will replace it with our custom layers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V6VePGdOr9qcCKKyvJzwqA.png" /></figure><p>Next, in <strong>Net Components</strong>, find the <strong>Python</strong> layer and drag/drop it into the Net visualization area. Click it to display its attributes under the <strong>Component Settings</strong> panel.</p><ol><li>Name: refers to the name of the layer. You can use the default value or assign a more meaningful name to your layer.</li><li>UserFor: refers to the phase in which you want your layer to be active.</li><li>Source: should point to the python script where you implemented your custom layer.</li><li>Top: is where you set the top blobs of your layer. The order of your top(s) must be as defined in your python script.</li><li>Module: should be the name (without the .py) you gave to the file where you implemented your layer.</li><li>Layer: should refer to the name of your class.</li><li>ParamStr: is the place where you pass parameters to your custom layer (assuming your layer is expecting some parameters).</li></ol><p>Now that we know the role of each attribute of the python layer, let’s first define our custom layer to be active during the train phase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CGyI1Spy9-7T9NZ9xtjHbw.png" /></figure><p>To make this layer fully operational, we have to define its bottom blobs (inputs). From the implementation, we know that this layer has two bottom blobs: predictions and labels. We also know that this layer is designed to be active during the train phase. Therefore, this layer must take its input from the last fully connected layer of the networks (for predictions) and the Data layer activated during the train phase (for labels). In addition, as per our implementation, since the model’s predicted outputs are the first bottom blob and the ground truth labels for train data the second blob, we must first connect the last fully connected layer to the python layer,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tjcmR04-jg_GDddzMzypHQ.png" /></figure><p>then connect the data layer activated during the train phase to the python layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E-9Ki9a4jYqXcN_Q7O-6kA.png" /></figure><blockquote>To determine which of the two data layer is active during the train phase, click on each and inspect its <strong>UseFor</strong> attribute under the Component Setting panel.</blockquote><p>If we inspect the attributes of the python layer again, we will notice that an additional attribute was added to it (after the connection with the data layer). This is because the data layer has two top blobs (outputs): the “image” data and the corresponding ground truths labels. The role of this new attribute is to determine which of the two outputs should be passed to the python layer.<br>Our python layer expects its input from the data layer to be the ground truth labels. We therefore naturally select <strong>label </strong>(and unchecked data since we don’t need the data when calculating our metrics).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PTJnU-tMwUR0mQlfNEigiA.png" /></figure><p>We now have a fully operational python layer that will be activated during the train phase. Following the same procedure, we can define the python layer that will be activated during the test phase. First we drag it into the visualization area and change its properties accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LvWbD4LXXg6qWGZE8yIYdA.png" /></figure><p>Next we connect the last fully connected layer to this python layer,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-1R9X7X7ZBnLLPS3F8Y6xw.png" /></figure><p>then connect the data layer activated during the test phase to this python layer .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W8OV1hghD9STukKXZe-v6Q.png" /></figure><p>And select <strong>label</strong> as the blob to be passed to the layer (and unchecked data since we don’t need the data when calculating our metrics).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M8Bs2EbcRFR_LZNROiPtWw.png" /></figure><p>And that’s it. Our python layers are now defined within our network architecture (AlexNet). One will be activated during the train phase and compute the train accuracy and confusion matrix, while the other will be activated during the test phase to compute the test accuracy, precision, recall, and f1-score.</p><blockquote>One thing we have not talked about yet but that is of paramount importance for all of these to work is knowing where to save your python script. We recommend that you save all your custom python layer files to a folder and add this folder to your PYTHONPATH. In our case, we have a custom python layer file called <strong>binaryMetricsLayer.py</strong>. Suppose this file resides in a folder named <strong>pythonLayerDlp</strong>. We must then add the <strong>pythonLayerDlp</strong> folder to our python environment with the following command: <strong>export PYTHONPATH=/path_to_pythonLayerDlp:$PYTHONPATH</strong></blockquote><p>Now that our python layers are set, what about we train the model on a binary classification task and see the output from our python layers in action?</p><h4>The Dataset</h4><p>We are going to build a cat/dog classifier. The dataset is comprised of 25,000 images of dogs and cats.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tZQ4o6HkBVWqEOWK7N4c9g.jpeg" /></figure><p>Using DLP, we have already prepared the LMDB databases for the train images and test images. You can download the data <a href="https://1drv.ms/u/s!AvA6mP_ngpmvdA5cba2Nnz-wzTs">here</a>. It has the following structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eW71kFa7pGVhOrh4W7dM9w.png" /></figure><h4>Training</h4><p>Before kick starting the training process of the AlexNet model with our defined custom metrics on the cats/dogs dataset, we need to:</p><p>1- feed the data into our network: this is done through each data layer via the <strong>Source</strong> attribute which should point to the corresponding (train or test) lmdb file.</p><p>2- normalize the data: by specifying the path to the dataset’s mean file under each data layer <strong>MeanFile</strong> attribute.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZOFTFmSOUVRbaaGITjTatA.png" /><figcaption>Example of configuring a data layer, that will be activated during the test phase, in DLP. The same should be done for the data layer that will be activated during the train phase. Just make sure each data layer point to its corresponding lmdb database. For the datalayer used during the train phase, you can used a form of data augmentation called mirroring by checking the <strong>Mirror</strong> option under the <strong>Transform</strong> attribute.</figcaption></figure><p>3- define the <strong>OutputNumber</strong> attribute of the last fully connected (InnerProduct) layer: to make sure that it corresponds to the number of classes/labels in our dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T1qpMO_NQOPtyBfk686NRg.png" /></figure><p>4- define the solver: the attributes of the <strong>Solver</strong> components of the network allow you to make a handful of decisions on the training and testing of the network. In our case, we modify the default <strong>TestInterval</strong> from 500 to 50 so that testing can happen every 50 iterations. We also modify the default value for the <strong>Display</strong> attribute from 100 to 10 so that we get a log output of the status of our training every 10 iterations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hcMI4mr9czkzZBC4RJeFQw.png" /></figure><p>Once you are done with these configurations, click on the <strong>Train</strong> button located next to the network library. You will be prompted to specify a directory to save your .prototxt files and other related files w.r.t training. Then, you will be directed to the <strong>Train</strong> tab where the actual training should take place.</p><p>You can monitor the training process via the log panel below the visualization area or through the different plots displayed in the visualization area. In particular, you can monitor the performance of your model on the test set, every 50 iterations (as defined in the solver), by examining the plots of the different metrics we’ve defined in the python layer for the test phase(accuracy, f1-score, precision and recall).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ewuYFaK2mE-3wiTLnrH6g.png" /></figure><p>Likewise, if you stroll down the visualization area, informations related to the training w.r.t the train phase (such as training accuracy, true positives rate, etc.) are displayed as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M-nRBpMmwJ-tHon_tQn19g.png" /></figure><p>All information displayed in the visualization area is intended to give you a visual way to monitor the training process and evaluate the performance of your model as training goes on. You can play with different configurations of your model and based on these informations, choose the one that works best. Likewise, you can even try a completely different model.</p><h4>Inference</h4><p>Once training is complete, you can head to the <strong>Deploy</strong> tab and start doing some inference on your trained model (saved as .caffemodel) using unseen data of cats and dogs. But you first need to configure the inference engine for classification.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SG2J1Ce9QJoH472klZV67g.png" /></figure><p>Here are the key points to remember:</p><p>1- The <strong>Type</strong> of inference is classification.</p><p>2- The <strong>Model</strong> is our trained binary classifier on cats/dogs: located in the same directory that you have defined for your .prototxt files. (generated during training).</p><p>3- The <strong>Prototxt</strong> refers to the one that contains the deploy keyword(generated by dlp just before the start of the training).</p><p>4- Pay attention to the <strong>CxHxW</strong> property under the <strong>Prototxt</strong> attribute. These letters represent the channel, the height and the width, respectively. For classification, your trained network expects your input data to be in the same shape as the image data used for training. Therefore, you must overwrite the default values of the CxHxW property and set them to the shape expected by the trained model.</p><p>4- The <strong>Label</strong> file is a text file in which each line refers to a name associated with each class of the dataset.</p><p>5- The <strong>MeanFile</strong> should be specified if only you’ve used it during training.</p><p>Once configured, enable the toggle button to start the inference engine. You can check if everything went well by inspecting the output of the log panel.</p><p>Now you can download some images of cats and dogs on the internet and save them locally. Next, you can load an image like the one on the left and the inference result of the image will be displayed on the right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ikEHnYbqQ30w8osdjhbhWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ph0VVtf1VFdyIERRPDlsMQ.png" /></figure><h4>Conclusion</h4><p>In this tutorial, we talked about the importance of the python layer, which is useful if you want to implement a feature that is not available in Caffe. We then discussed the different process you need to follow if you want to create your own custom python layer. To illustrate this, we designed a custom metrics layer for binary classification and explain how it can be used on the DLP platform to train a binary classifier.</p><p>If you found this tutorial useful, please give it a clap and spread the words :). For any questions, comments or suggestions, please leave a comment below or contact us @ <a href="/service/mailto:ai_dlp@163.com">ai_dlp@163.com</a> You can also visit our website to find out more about DLP and what it can do.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f40f876639f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Your Own Object Detector Model Using FasterRCNN In DLP]]></title>
            <link>https://medium.com/@aidlp20180201/building-your-own-object-detector-model-using-fasterrcnn-in-dlp-3e1bc5ada64b?source=rss-d934ad0d2e00------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e1bc5ada64b</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[image-recognition]]></category>
            <category><![CDATA[convolutional-network]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[object-detection]]></category>
            <dc:creator><![CDATA[ai-dlp]]></dc:creator>
            <pubDate>Thu, 30 Aug 2018 01:22:03 GMT</pubDate>
            <atom:updated>2019-01-28T04:32:37.678Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial, we will introduce you to object detection in DLP using a popular object detection algorithm known as FasterRCNN. We will use person/basketball detection as an example to illustrate how to create a detection model using FasterRCNN in DLP. By the end of this tutorial, in addition to understanding how to create and manage your own training data for detection in DLP, you will be able to take a single color image, such as the one on the left, and produce an output labeled as the image at right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gTafemvncCV4DJgAzW0ICw.png" /></figure><h3><strong>Overview</strong></h3><p>This tutorial is divided into 6 parts; they are:</p><ol><li>What is DLP</li><li>Before You Get Started</li><li>Set Up DLP</li><li>FasterRCNN in a Nutshell</li><li>FasterRCNN In DLP</li><li>Summary</li></ol><h3><strong>What is DLP?</strong></h3><p>Deep Learning Platform (DLP) is a piece of software for deep learning (DL) application development without coding that is currently built on top of Caffe deep learning framework. DLP end-goal is to provide anyone interested in applying DL on their problem, with a cross-platform software (running on Ubuntu, MacOS, Windows), that makes it easy to build powerful DL models, like a PRO, regardless of their DL skill. To deliver on this promise, we strive to provide a seamless visual solution to DL, from data labeling, network definition/design, to training and inference that allows for rapid network prototyping and deployment.</p><p>With the current version of DLP (version 2), you can perform image classification, semantic segmentation (pixel classification) and object detection, as well as create and manage your own dataset with powerful built-in image annotations tools.</p><h3><strong>Before You Get Started</strong></h3><p>The easiest and recommended way to get started with DLP is to use the docker-based development environment. You can learn more about Docker <a href="http://www.docker.com/">here</a>.</p><p>This is an end-to-end recipe for running DLP on an Ubuntu machine. This installation will allow you to enjoy all the features of DLP, assuming your Ubuntu machine has a functional GPU.</p><h4><strong>Install Docker</strong></h4><p>Download this <a href="https://1drv.ms/u/s!AvA6mP_ngpmvaXSkCFCnZEXiNak">shell script</a> and run it in your terminal using the following command (not including the dollar sign):</p><ul><li><strong>$ sh Docker-install.sh</strong></li></ul><h4><strong>Install Nvidia-docker</strong></h4><p>Download this <a href="https://1drv.ms/u/s!AvA6mP_ngpmvakpT3toi_KTFBiA">shell script</a> and run it in your terminal using the following command (without the dollar sign):</p><ul><li><strong>$ sh Nvidia-docker-install.sh</strong></li></ul><h4><strong>Create the Docker User Group</strong></h4><p>In the terminal, enter the following commands (without the dollar sign):</p><ul><li><strong>$ sudo groupadd docker</strong></li><li><strong>$ sudo usermod -aG docker $USER</strong></li></ul><p>Then Log out and log back in so that your group membership is re-evaluated. If testing on a virtual machine, it may be necessary to restart the virtual machine for changes to take effect.</p><h4><strong>Download and install DLP</strong></h4><p>You can download DLP from our website <a href="http://www.ai-dlp.com/"><strong>www.ai-dlp.com</strong></a>.</p><h3><strong>Setup DLP</strong></h3><p>Open DLP and you will land in the main window from which, among others things, you can define the task you want to perform:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z1Ca4E706Q6umv2TIAhICg.png" /></figure><p>Since in this tutorial our goal is to build a person/basketball detector, under the <strong>1. Select the data type </strong>select <strong>Image</strong> then select <strong>Detection</strong> uder <strong>2. Select the model</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*WXKCFLIRJowzFydh41Yybw.png" /></figure><p>Click Continue to move to the next window, the Data module.</p><p>Say you have a lot of images containing objects of different types and sizes and you want to build an object detector. The first step you will need to take is to manually annotate your training data, i.e. drawing bounding boxes (rectangles) in your images around your objects of interest. The data module in DLP is where this process takes place and we will show you how in this tutorial.</p><p>That said, there are two important steps before we really start: to define our project directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qzIImxqGT7f0KZg9BXkutA.png" /></figure><p>and to pull out DLP Ubuntu Docker container.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EjI2WTMYW1fpFJjtudUXaA.png" /></figure><p>You should be able to successfully pull out the docker if you have successfully completed every steps listed under the <strong>Before You Get Started</strong> session.</p><h3><strong>FasterRCNN in a Nutshell</strong></h3><p><a href="https://arxiv.org/abs/1506.01497">FasterRCNN</a> is currently a state-of-the-art object detection algorithm and, as the name suggests, is faster than its predecessor (<a href="https://medium.com/%20//%20arxiv%C2%A0.org%20/%20abs%20/%201311.2524">R-CNN</a> , <a href="https://arxiv.org/abs/1504.08083">FastRCNN</a>). Graphically, its workflow can be summarized as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*z-xe0-_ZAzZk1F89HdJimw.png" /></figure><p>As illustrated in the diagram above, FasterRCNN relies on a base/pretrained network (typically on ImageNet) to compute the image <strong>Feature Map</strong>. It then runs these feature maps on a separate network named Region Proposal Network (RPN) that ranks region boxes (called <strong>anchors</strong>) and proposes those that most likely contain objects. These regions of interests are then fed into a series of layers (<strong>ROI Pooling</strong>, fully connected layers) to generate class label and bounding box coordinates for each of those objects.</p><p>Two important terminologies have been introduced: anchors, and region of interest pooling (ROI Pooling). What are they? What are they used for?</p><p><strong>Anchors</strong> are fixed-size rectangles (boxes) of different scales and ratios used to locate object of various shapes and sizes (e.g. persons, basketball, etc). In FasterRCNN default configurations, 3 scales and 3 ratios are used to define these anchors, which makes for a total of 9 anchors. RPN takes these anchors and runs them at each spot of the feature maps generated by the pretrained network to produce regions of interest.</p><p>Once RPN produces the regions of interest (ROI), these ROIs can be of different size. And since these ROIs are to be fed into fully connected (FC) layers, which expect fixed-size vectors, we need to do ROI pooling first. <strong>ROI Pooling</strong> layer is used to produce fixed-size vectors from feature maps of different sizes. This is done by dividing each feature maps into a n by n non-overlapping regions and getting the maximum value in each region.</p><p>Now that we have an idea of how FasterRCNN detects objects in images, let’s dive back into DLP.</p><h3><strong>FasterRCNN In DLP</strong></h3><p>DLP uses the implementation of FasterRCNN with ZF and VGG16 as base/pretrained networks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5FS4H3mbDRPsBTvWxpa73g.png" /></figure><p>We will build our person/basketball detector using FasterRCNN-ZF because of the simplicity of the architecture. Therefore ZF network will be our base model. You can download a pretrained ZF net specifically designed for this task <a href="https://1drv.ms/u/s!AvA6mP_ngpmvbkEGBKVTMJ5-JX8">here</a>.</p><p>The remaining of this section is divided in two parts : in the first part, I will illustrate how to train your dataset using FasterRCNN, assuming the images and annotations files are ready. In the second part, I will explain how to annotate your own images for detection in DLP and use the annotated dataset to build a custom object detector.</p><h4><strong>Part 1. Basketball Detection</strong></h4><p>In this part, basketball detection will be used as an example. By the end of this part, you will be able to use a single color image as the one on the left and produce a labeled output like the image on the right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Stj5bOIeKPZhgO1fGa2jVA.png" /></figure><h4><strong>Download Dataset</strong></h4><p>The dataset used in this part is downloaded from ImageNet. Here we provide a link to download the <a href="https://1drv.ms/u/s!AvA6mP_ngpmva-mCzKb64KbIHDo">basketball dataset</a>. Once you have downloaded the dataset, you can unzip it into your project directory. The dataset should have the following structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*krOsWAM9J6eE2e9V9wXtjQ.png" /></figure><p>And your project directory should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7_1zK2zxn4cQ90vX-6_Jhw.png" /></figure><h4><strong>Prepare Network</strong></h4><p>By convention, if you have n classes (n objects of interest) in your dataset, consider it a (n+1)-detection task where the extra class is the background that typically represents each object that you have not defined as object of interest. In this example of basketball detection, since we only have 1 object of interest (basketball), our basketball detection task is therefore a 2 objects (background included) detection problem.</p><p>That said, it is time to define/modify some default FasterRCNN-ZF configurations to fit our binary detection task, the goal being to detect a basketball object (named n02802426) in an image. On DLP, drag the FasterRCNN-ZF component and drop it into the visualization area.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8V2e0jLg1G4icINFTCMPYw.png" /></figure><p>Visualizing FasterRCNN-ZF on DLP, you can easily and certainly better understand the workflow of the algorithm. If you are familiar with ZF-net, you can easily dissect the 3 main components of FasterRCNN as described in section III of this tutorial, namely a base network (ZF-net in this case) responsible for producing feature maps of input images, the RPN net that runs anchors on each spot of feature maps generated by the base network to rank regions/boxes and output the ones most likely to contain objets, and a classification/regression network that uses RPN region proposals to output object class and the associated bounding box coordinates.</p><p>You can configure and/or inspect each layer of the network simply by clicking on the associated component. The configuration associated with the component you clicked will then show up in the <strong>Component Setting</strong> panel, as illustrated below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D8P_LWlKMtDGqtsrohpRww.png" /></figure><p>The first thing to do is tell FasterRCNN-ZF where to get the training data. And this is done under the <strong>Input</strong> component of FasterRCNN. There, you must specify the path to your image dataset folder, and to the .txt label file corresponding to your dataset.</p><p>Then, we must update the number of classes in the ROI data layer to 2 because we only are dealing with 2 classes (background and basketball).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*61uECzxaJA-eavQWSyx0Ig.png" /></figure><p>Next, we must update the number of output in final layers. One final layer outputs object classes, so we must update its number of output to 2 because we only have 2 classes (including the background). The other final layer outputs bounding box coordinates for each class, so its output number must be 8 which corresponds to 4 bounding box coordinates * 2 classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vCVeN67yczQAUB1hJanQVA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ErT6MFFZ99Dw2508yX3s3Q.png" /></figure><p>Finally, we need to configure the <strong>Solver</strong> component. Here, the most important property of the solver component to which we must pay attention to is the <strong>Pretrained</strong>. There, we have to load the <a href="https://1drv.ms/u/s!AvA6mP_ngpmvbkEGBKVTMJ5-JX8">pretrained model</a> by specifying the path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xMTPreEbV2K589HEcL6AcA.png" /></figure><p>Then we can consider properties like the maximum number of iterations (I run for 2,000 iterations), when to save a snapshot of the model (I choose to save for every 1,000 iterations), and the <strong>SolverMode</strong> (you must select GPU).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cWGCgLgCvqSxKTQDrjfHog.png" /></figure><p>We are now all set to begin training our model. Click on the Train button in the upper-right corner of the window. You will be asked to choose a folder in which to save your network configuration files. This is where your snapshots (models) will also be saved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YBrNT2VDxFQFn1i-x0s3Ig.png" /></figure><h4><strong>Model Training</strong></h4><p>You will then automatically be directed to DLP Train module where you can monitor the training process via different plots or through the log panel. Of all, the most important information to monitor is the mean average precision (mAP) herein computed on the validation set. mAP is the metric used to evaluate the performance of detection algorithms. In DLP, for FasterRCNN, this metric is calculated each time a snapshot of the model is performed. Since we have defined the solver so that we train for 2,000 iterations and take a snapshot of the model every 1,000 iterations, the training is evaluated twice via the mAP calculation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1VbEE10uTY3277RM2d2AYA.png" /></figure><p>It can be seen that after 1000 iterations, the mAP score on the validation data is greater than 78% and climbs to more than 91% at iterations 2,000. We will therefore use the second model for inference on unseen dataset.</p><h4><strong>Model Inference</strong></h4><p>During training, models are saved as .caffemodel file within the folder you have selected to host the network configuration files. This folder should looks like the following after the training:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T9qB-nppFQ9ZX3jZ0ftc2A.png" /></figure><p>The .caffemodel obtained after training for 2,000 iterations, and the _deploy.prototxt file generated by DLP in the previous step are both needed, in addition to the label.txt file, for inference.</p><p>We will now do inference on a couple of images downloaded from the internet using our trained model. Click <strong>Next</strong> or on the <strong>Deploy</strong> tab to move to DLP Deploy module. Then click on the dropdown button where you will see the options to configure. Under the <strong>mode</strong> option select GPU (and corresponding GPU ID if necessary), and then choose the type of inference you would like to perform (detection in this case).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LHenHy5UArdH5KlQjkmggg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sbI7GzM7M9lXyK1S87ENow.png" /></figure><p>Afterward, fill in the detection model (.caffemodel), the deploy.prototxt file, and the label.txt file in their respective fields. Then the dropdown button will turn green to indicate that the inference engine has all the required files and can now be activated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v6u5dHwOX3Dhwr7tYMLPNQ.png" /></figure><p>Turn on the toggle button to start the inference engine. You can check whether everything went well by inspecting the log panel output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_xOwKwU8VGJZMCz5Dv_8HA.png" /></figure><p>All that remains is to load an image like the one on the left, and DLP will use your trained model to produce a labeled output like the image on the right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cj4vGfh2dkKtsgSCYSL6HA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e86o42v2JFJlZ-Qd7XTF7Q.png" /></figure><p>That’s it for basketball detection. Next, let’s see how we can use a subset of the basketball dataset to build a person/basketball detection model. The next part will be particularly interesting in the sense that we will start from an unlabeled image dataset and show how it can be annotated/labeled for detection.</p><h4><strong>Part 2. Person/Basketball Detection</strong></h4><p>In this part, person/basketball detection will be used as an example. By the end of this part, you will be able to annotate/label your own unlabeled image dataset for detection,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*efcsIEFL1NC6iTy7h8AbhQ.png" /></figure><p>use FasterRCNN to train on it, and take a single color image as the one on the left to produce a labeled output like the image on the right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KGMuzi6PV01ooSQBDm5N1g.png" /></figure><h4><strong>Download Dataset</strong></h4><p>The dataset we will work with in this part is a small subset of the basketball dataset used above. Typically we randomly selected 98 raw images from the JPEGImages folder of the basketball dataset, and that’s it. We do not need the associated annotation files to those images as we are going to label the data ourselves using DLP built-in image annotation tool. The folder containing the 98 raw images we randomly selected from the basketball dataset can be found <a href="https://1drv.ms/u/s!AvA6mP_ngpmvbEqlBWoui5gXCbk">here</a>.</p><h4><strong>Image Annotation/Labeling For Object Detection</strong></h4><p>Labeling dataset for object detection consists in drawing bounding boxes (rectangles) around each object of interest in each image in your dataset. In DLP, to start labeling for object detection on your own image dataset, make sure you have selected Image under the <strong>1. Select the data type</strong> and Detection under the <strong>2. Select the model type.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*WXKCFLIRJowzFydh41Yybw.png" /></figure><p>The Data module will be our playground, so be sure you are in this module. Then, on the Function Bar, click <strong>AddImg</strong> and navigate to the folder containing your raw images to load your dataset into DLP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XUShbxvCFhShiXKDo5qaJQ.png" /></figure><p>From the visualization area, you can inspect your images, add in more images, delete images, and more. Before we start labeling our images, we must first define our objects of interest. For this example, our objects of interest are <strong>person</strong> and <strong>basketball</strong>. To define them in DLP, on the Function Bar, click on <strong>AddObj</strong> to add an object that you can inspect in the <strong>Object Setting</strong> panel on the right. By default, the objets of interest are named respectively Object-1, Object-2. You can edit each to give it a more meaningful name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jW0G-2j6XzvECsKnvaou5g.png" /></figure><p>To start labeling (drawing bounding boxes), double click on the visualization area to switch on the single mode for convenience, or simply click on the SView function. Subsequently, in the Function Bar, select <strong>Labeling </strong>and, in the <strong>Object Setting</strong> panel, to select the object you want to label, click the associated label.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2ypymDUqtgLJd3RXDkKhkw.png" /></figure><p>On the image click to begin drawing bounding box (rectangle) around an object and click again to complete the drawing. If you want to delete an unwanted bounding box, just right-click on it and a <strong>Delete</strong> option will appear to allow you to delete that rectangle. When labeling an image, it is recommended:</p><p>1. To begin drawing from the smallest object to the largest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mLRrZO5X26hqQ7LfoJMnIw.png" /></figure><p>2. To begin labelling from the innermost object, if your objects of interest overlap.</p><p>3. To always make sure your bounding boxes do not exceed the margin of the image.</p><p>And of course bounding box border can be resized to better fit an objet.</p><p>As you progress through your labeling task, you can always check how many objects (not images) have been labeled so far for each object category.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0wejm1uDEu4IMa5YKFsRcA.png" /></figure><p>You have probably noticed the <strong>Image Setting</strong> panel just below the <strong>Object Setting</strong> panel. It is primarily used to define certain properties that will be used when you are about to export or convert your dataset after you finish labeling. The properties you will most likely be concerned with are the name you wish to give to your labeled dataset, the format in which the dataset will be exported/converted (note that you have options between FasterRCNN, SSD, and, YOLO formats), and the percentage split for the test set. For this example, since we are building a person/basketball detector using FasterRCNN, this is the format we will select when exporting our labeled dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P1Go2LePit6MRkkLa5EItA.png" /></figure><p>The converted labelled dataset should have the following structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FQ-FwNzPXYAG2nF0n64zXg.png" /></figure><p>As it can be seen, the structure of DLP generated labeled dataset is very similar to that of the basketball dataset we explored in part 1, with the exception of the .dat file which is essential for loading our dataset into DLP and to continue labeling where we left off the last time (by either adding new images to label or continuing to label unlabeled images). You can download the annotated person/basketball dataset in <a href="https://1drv.ms/u/s!AvA6mP_ngpmvbaToUOVEfyqgFm8">here</a>.</p><h4><strong>Prepare Network</strong></h4><p>This process is very similar to what we did with the basketball dataset, except that we now have 3 classes (background included) instead of 2. This implies that the number of classes in the ROI data layer must be updated to 3. The same is true for the number of outputs of the final layer that produces the object classes, which must also be updated to 3. Likewise, since we now have 3 objects, the other final layer that produces bounding boxes coordinates for each class must now have its output number updated to 12, corresponding to 4 bounding box coordinates * 3 classes.</p><p>Next, you have to specify the path to your image dataset folder, and to the .txt label file (person-basketball_labels.txt in this case) corresponding to your dataset. Of course this is done within the <strong>Input</strong> component of the network.</p><p>Finally, I will use the same Solver configuration as the one used for the basketball dataset, do not forget to fill in the Pretrained property with the path to ZF net, with the only exception that I will now set the maximum number of iterations to 3,000 instead of 2,000 used for the basketball dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5IiKKiXe6noB9XBpdAQe6A.png" /></figure><h4><strong>Model Training</strong></h4><p>Training on such a small dataset, FasterRCNN-ZF model can achieve over 62% in mAP score after just 3,000 iterations. Not sure whether training for a bit longer might improve the result, but annotating/labeling more images will definitely drastically improve it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EW9DjA9p957S2xbDb-_UsA.png" /></figure><h4><strong>Model Inference</strong></h4><p>There are three files needed to perform inference for detection on the Deploy module, namely a .caffemodel, a _deploy.prototxt file, and a _labels.txt file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o3cDg7oWVllrRNHNuYsZkA.png" /></figure><blockquote>PS: DLP automatically creates the deploy.prototxt file and .caffemodel during the training process. The _labels.txt model, on the other hand, is automatically created only if you have annotated and converted your image dataset in DLP. Otherwise, you will have to manually define the .txt file.</blockquote><p>Turn on the toggle button to start the inference engine. You can check whether everything went well by inspecting the log panel output. Subsequently, load an image like the one on the left, and DLP will produce a labeled output like the image on the right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I2Uc1o-vKlrm88odvPC2RA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aMves5r_xamMd1d7u2ZzOQ.png" /></figure><h3><strong>Summary</strong></h3><p>In this tutorial, you discovered how to build an object detector model in DLP with FasterRCNN.</p><p>Mores pecifically, you have learned:</p><ul><li>How FasterRCNN works for object detection.</li><li>How to use DLP built-in tool to annotate your image dataset for object detection.</li><li>How to train a custom dataset with FasterRCNN in DLP.</li></ul><p>Where to go from here?</p><ul><li>You can annotate your own dataset for detection in DLP.</li><li>You can try training with FasterRCNN-VGG16, which is a more powerful (and large) network than FasterRCNN-ZF.</li><li>You can experiment with different solver configurations.</li></ul><p>What’s next?</p><ul><li>Build an object detector model in DLP with SSD network.</li></ul><p>Do you have any questions?</p><p>Ask your question in the comment below and I will do my best to answer, or reach us out at <strong>ai_dlp@163.com</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e1bc5ada64b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using DLP To Train A Semantic Segmentation Network On MRI Images]]></title>
            <link>https://medium.com/@aidlp20180201/using-dlp-to-train-a-semantic-segmentation-network-on-mri-images-1df39cb847cd?source=rss-d934ad0d2e00------2</link>
            <guid isPermaLink="false">https://medium.com/p/1df39cb847cd</guid>
            <category><![CDATA[deep-learning-platform]]></category>
            <category><![CDATA[sunnybrook-left-ventricle]]></category>
            <category><![CDATA[semantic-segmentation]]></category>
            <category><![CDATA[image-segmentation]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[ai-dlp]]></dc:creator>
            <pubDate>Sun, 29 Apr 2018 13:12:42 GMT</pubDate>
            <atom:updated>2018-04-29T13:21:27.829Z</atom:updated>
            <content:encoded><![CDATA[<p>In this post we will see how DLP may be used to train a semantic segmentation network for medical imaging. More specifically, we will use the Sunnybrook Left Ventricle Segmentation Challenge Dataset to train a Caffe model to segment the left ventricle out of MRI images. By the end of this tutorial, you will be able to take a single MRI image, such as the one on the left, and produce a labelled output — outlining the location of the left ventricle in the MRI input image — such as the image in the right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1gHNta1xYY0DpwH8.png" /></figure><h3>Set Up DLP</h3><p>The first step is to launch DLP. If you haven’t installed it yet, you can request a copy from our <a href="http://www.ai-dlp.com/index.html">website</a>. DLP is built on top of the <a href="http://caffe.berkeleyvision.org/">Caffe</a> deep learning library, so please make sure Caffe is properly configured in your system. Make sure you also compile Caffe’s python wrapper.</p><p>The following window will show up once you launched DLP:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ve48mcEn0W7BcAuK.png" /></figure><p>On the upper right corner of the navigation bar, click on the dropdown button. There, specify the paths to Caffe’s tools subdirectory <strong>(caffe/build/tools)</strong>, Caffe’s python wrapper subdirectory <strong>(caffe/python)</strong>, and the path to the bin directory containing your environment’s python (in MacOs and Ubuntu you can enter the <strong>“which python”</strong> command in your terminal. It will return the path to where python is installed. <strong>Python bin</strong> should point to that path up to the bin folder which contains the Python executable file).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FzhSKNDmgkgXCLm3.png" /></figure><p>Now under the <strong>“1. Select the model type”</strong> select Segmentation, and under <strong>“2. Select the data type”</strong> select Image, then click on Continue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BlDvlgcTGU3fUT7z.png" /></figure><p>You will land in the window below where the only operation we are going to perform will be to set our current working directory. Locate the <strong>SetDir</strong> button at the upper left corner of the function bar, click on it and a window will pop up where you can set your working directory. <strong>Please make sure you specify a file that does not require access permissions.</strong> This is important especially for DLP’s Deploy module to work fine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YR1S3rWsQo7u4naG.png" /></figure><h3>Get The Dataset</h3><p>In this tutorial, we will use the <a href="http://smial.sri.utoronto.ca/LV_Challenge/">Sunnybrook Left Ventricle Segmentation Challenge Dataset</a>. The dataset consists of 16-bit MRI images in DICOM format and expert-drawn contours in text format (coordinates of contour polylines). A sample image/label pair may look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7xAsdGiX5clu-C2y.png" /></figure><p>You will have to register on the <a href="http://www.ai-dlp.com/smial.sri.utoronto.ca/LV_Challenge/">Cardiac MR Left Ventricle Segmentation Challenge website</a> and download links to the dataset will be emailed to you. Unfortunately, in the latest release the filenames have become a little mangled and don’t match up with the contours. For the sake of simplicity, in this example, we are going to provide you with the Sunnybrook Left Ventricle Segmentation Challenge Dataset in a format (lmdb) required to train a Caffe model. Download the data from <a href="https://pan.baidu.com/s/1TqciYs4ZsIxtqH9RcWlHmQ"><strong>here</strong></a>.</p><p>The dataset file structure should look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/0*X9BAaatgnKqMSpHF.png" /></figure><p><strong><em>PS:</em></strong><em> Details on how DLP may be used to generate labels for segmentation, using your own image data, will be the subject of an upcoming post.</em></p><h3>Model Definition</h3><p>Getting back to DLP, select the Net tab in the navigation bar. This is where we will define our model. There are three ways you can interact with DLP in order to define your network architecture. You can either import your network definition (Caffe “.prototxt” files), <strong>build</strong> it from within DLP with a <strong>drag/drop </strong>fashion using DLP’s Net Components, or simply select one network architecture from the list of predefined network architectures present in DLP’s <strong>Net Library</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TuaZ0hVrXyO6PZPJ.png" /></figure><p>In a previous post, we introduced DLP and how it may be used to <a href="https://medium.com/@aidlp20180201/train-a-convolutional-neural-network-cnn-classifier-using-dlp-5769a61c9304">Train a convolutional neural network (CNN) classifier</a>. There we defined image classification as the task of classifying what appears in an image into one out of a set of predefined classes. This assumes that there is only one object of interest/focus in the image.</p><p>Image segmentation is a much more sophisticated task. Given an image, its goal is to divide the image into segments/regions belonging to the same part/object/content. One way to achieve that is to use a technique known as semantic segmentation.</p><p>Image semantic segmentation can be thought as a generalization of image classification. Given an image, its task is to classify every single pixel in the image into one out of a set of predefined classes. Such an image classification tends to create contours around part of the image because nearby pixels are often of the same class and hence, this is a technique used for image segmentation.</p><p>Now a <strong>fully convolutional network (FCN)</strong> is one where all the learnable layers are convolutional, so it doesn’t have any fully-connected layer. This is to contrast with CNN which has some convolutional layers followed by one or a few fully-connected layers. The idea behind FCN is to preserve the spatial arrangement from the input image which is useful for image segmentation.</p><p>In order to train an FCN for semantic segmentation, a suitable pre-trained classification model (trained on the ImageNet classification dataset) must be used. Basically, standard pre-trained classification networks (such as AlexNet, and VGGNet) are converted into fully convolutional networks and their learned representations are transferred by fine-tuning to the semantic segmentation network. Converting a standard CNN to FCN (also known as convolutionalizing a CNN) is usually a three-step process:</p><p><strong>1.</strong> Start with a pre-trained CNN for classification, i.e: AlexNet</p><p><strong>2.</strong> Convert all the fully-connected layers to convolutional layers with 1x1 filter/kernel size.</p><p><strong>3.</strong> Add a deconvolution (or transposed convolution) layer(s) on top of your network to scale up the scale down effect made on previous layers. The idea is to recover the activation positions to something meaningful related to the size of the image.</p><p>FCN models were first introduced in this <a href="https://www.cv-foundation.org/openaccess/content_cvpr_2015/papers/Long_Fully_Convolutional_Networks_2015_CVPR_paper.pdf">paper</a>.</p><h4>FCN in DLP</h4><p>In the DLP Net Library, two FCN architectures from <a href="https://github.com/shelhamer/fcn.berkeleyvision.org">fcn.berkeleyvision.org</a> are available.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rJGCQp36C7iAyNLj.png" /></figure><p>We will use AlexFCN. In order to successfully train AlexFCN, we will need the convolutionalized (converted from CNN to FCN) pre-trained AlexNet model which can be downloaded <a href="https://pan.baidu.com/s/1vnjQ-dYoHmo759LSn7TWhg">here</a>. Now <strong>drag</strong> the AlexFCN button from the Net Library and <strong>drop</strong> it into the visualization area.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3dNkjBJ8ctna3D60.png" /></figure><p>Now we need to define/modify the network architecture to fit our semantic segmentation task which is to segment the left ventricle out of Cardiac MRI images.</p><p>First off, we need to feed the data into the network. This is done by clicking on the Data component/layer of the network and in the Component Setting panel set the path to the lmdb file corresponding to that Data layer. In order to know which lmdb file goes to which Data layer, refer to the default name given to each data layer (you can edit those names but it is recommended not to). For instance in the image below, the Name property (in the Component Setting) associated to the highlighted Data layer is label_train. This means that the Source property must point to the lmdb folder referring to the labels of the training data, which is named train_gt_lmdb in the dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*U_Ho7Iy4OkNFzgin.png" /></figure><p>Do the same for all the other Data layers, each time paying attention to the Name property of each Data layer to figure out what lmdb file should go where.</p><p>Next, we want to modify the Name property associated to two convolution layers in our network. More precisely we want to change convolution layers associated to the Name <strong>conv6</strong> and <strong>conv7</strong> to <strong>fc6 </strong>and <strong>fc7</strong>, respectively. This is to make sure that all the layers name in our network matches the layers name from the pre-trained model (AlexNet in this case) which will be defined shortly. This is important for transfers learning and fine-tuning, techniques required to successfully train our FCN model for this task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RHIXjN5n3h1vhJjp.png" /></figure><p>Next, make sure the <strong>FeatureMapNum</strong> property of both the last convolution layer and the deconvolution layer is set to 2. This is because our segmentation task has only one object of interest (the left ventricle) in all Cardiac MRI images. So the pixels associated to the left ventricle were set to 1 and everything else (background) set to zero, which boils down to a 2-class classification task. We should keep in mind that semantics segmentation learn to predict pixel-wise classification. So for this network, the FeatureMapNum property of both the last convolution layer and the deconvolution layer should be set to “the number of object of interest in your dataset + 1 (if you take into account the background which typically refers to everything else other than your object(s) of interest)”.</p><p>Lastly, we should define/modify some properties of the <strong>Solver</strong> component. We want to train this model for a maximum of 10k iterations and save a snapshot every 5k iterations. We can either train on GPU or CPU and this is defined by the SolverMode property. Last but not the least we need to specify the pre-trained model which we downloaded above, and this is done under the Pretrained property of the Solver component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Tz6CONMsMftaplse.png" /></figure><p>We are now up and ready to launch the training via the <strong>Train</strong> button located at the right of the <strong>Net Library</strong>. Clicking on the <strong>Train</strong> button will trigger a pop up window requiring you to save your network structure information, and will direct you to the Train module.</p><h3>Model Training</h3><p>The Train module is where the training takes place. Here you can monitor the training by expecting different plots.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*STSmrN_s4DKPprXt.png" /></figure><p>Notice that the accuracy score on the validation data starts very high (a little bit over 98%). This is understandable given that less than 2% of pixels of each MRI image used represent the left ventricle. So it suffices for the network to classify every single pixel as background for it to reach such a high accuracy. This is the reason we have to train the model for longer, to make sure it actually learns the intrinsic features of the data in order to perform well rather than just lazily classify all pixels as background.</p><p>Once the training is completed, a pop up message will notify you of the completion, click on ok</p><h3>Model Inference</h3><p>Click on the <strong>NextStep</strong> command to head to the <strong>Deploy</strong> module.</p><p>If you have followed this tutorial correctly, you would be able to use your trained model to make inference on unseen Cardiac MRI image data. We are going to use MRI images located under the subdirectory test_images from the dataset we downloaded previously. These images are a subset of the test set from the Sunnybrook Left Ventricle Segmentation Challenge Dataset.</p><p>To start making predictions on new image data, there are two files we need to prepare: a <strong>deploy.prototxt</strong> file, and a text label file. Your <strong>label.txt</strong> file should contain the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/0*7cVk2Bdjwvdc-Cxo.png" /></figure><p>where the background Indicates everything that is not a left ventricle.</p><p>To create the <strong>deploy.prototxt</strong> file is quite straightforward as well. Remember at the end of the Model Definition section you were prompted to save your model structure under Caffe “.prototxt” file format. Open up that file and copy everything from there except for the data layers, loss layer, and accuracy layer. Create a <strong>deploy.prototxt</strong> file and paste what you have just copied in there. Then at the very top or beginning of the file, insert the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/0*hc5RqcOZOxxRM9_u.png" /></figure><p>You can download the deploy.prototxt file used in this example <a href="https://pan.baidu.com/s/15-uJpG_oozAmbVsNWDf-5A"><strong>here</strong></a>.</p><p>Next click on the dropdown button to configure the inference engine. There we will specify whether or not to use GPU during inference, the type of inference to perform, and set up paths to the caffemodel we just trained and to the deploy.prototxt and the label.txt we created just above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ybSsqRLJctQpQxrb.png" /></figure><p>The dropdown button will turn green signaling that all required parameters have been provided. Then turn on the toggle button to start the inference engine.</p><p>Now all what remains to do is to load an image like the one on the left, and the model will output the same image but with the predicted location of the left ventricle highlighted on it, like the image in the right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Eva7FTMMdgRpsuBV.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jM8cs4p-EuuqWUxM.png" /></figure><p>The predicted results will be saved as images in your working directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/0*VnzdPJEgMYeqRaeM.png" /></figure><h3>Conclusion</h3><p>We’d love to hear about your experience using DLP, or if you have any further questions, or just want to discuss any issues you experience with the tutorial, please get in touch via our official email account <a href="/service/mailto:ai_dlp@163.com">ai_dlp@163.com</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1df39cb847cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Train a convolutional neural network (CNN) classifier using DLP]]></title>
            <link>https://medium.com/@aidlp20180201/train-a-convolutional-neural-network-cnn-classifier-using-dlp-5769a61c9304?source=rss-d934ad0d2e00------2</link>
            <guid isPermaLink="false">https://medium.com/p/5769a61c9304</guid>
            <category><![CDATA[deep-learning-platform]]></category>
            <category><![CDATA[fashion-mnist]]></category>
            <category><![CDATA[image-classification]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[caffe]]></category>
            <dc:creator><![CDATA[ai-dlp]]></dc:creator>
            <pubDate>Sun, 29 Apr 2018 11:34:36 GMT</pubDate>
            <atom:updated>2018-04-29T13:14:20.688Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yD0FyR0M2u6d4YDgBWT8vA@2x.png" /></figure><p>In this post we will see how <a href="http://www.ai-dlp.com/"><strong>DLP</strong></a>, which stands for <strong>Deep Learning Platform</strong>, may be used to train a convolutional neural network (CNN) classifier. More specifically, we will use the <a href="https://github.com/zalandoresearch/fashion-mnist"><strong>Fashion-MNIST</strong></a> dataset to train our CNN classifier. By the end of this tutorial, you will be able to take a fashion image item, such as the one on the left, and produce a labelled output, such as the image in the right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FchQSyD9w87Dw4ngq7hFSw.png" /></figure><p>But before we get started, let have a quick overview of DLP. If you have not yet done so, head to <a href="http://www.ai-dlp.com/"><strong>www.ai-dlp.com</strong></a> and claim a copy of DLP. It is available for all three major OSs out there namely, Windows, Linux, and Mac.</p><p>Yeah I know by now you may be wondering what exactly is DLP? well, DLP is a software dedicated to deep learning (DL) application development without coding, and built on top of the popular deep learning framework <a href="http://caffe.berkeleyvision.org/"><strong>Caffe</strong></a>. It comprises main modules of a DL application pipeline: <strong>Data</strong>, <strong>Net</strong>, <strong>Train</strong>, and <strong>Deploy</strong>. We will explore each of these modules in the context of classification with DLP.</p><p><strong><em>PS</em></strong><em>: Since DLP is built on top of the Caffe deep learning framework, it is expected that you have Caffe with the python API installed on your system if you want to follow along from start to finish. However, DLP only relies on Caffe for training a model but other mundanes DL tasks such as data preparation, network definition, and model deployment can be done on DLP and does not require you to have Caffe installed on your system.</em></p><p>Now let us launch DLP. Once launched, you are greeted with the screen below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UCcm5HhN6mjUFYWILkkiBQ.png" /></figure><p>There we have many combinations of options to choose from. Under the <strong>“1. Select the model type”</strong>select Classification, and under <strong>“2. Select the data type”</strong> select Image, then click on <strong>Continue</strong> and you will land on the following page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t3nC7up2WqHKScx80prwKw.png" /></figure><p>This interface is where all of our data preprocessing work for classification will take place. But before we get into it, let’s familiarize ourselves with the interface’s main parts:</p><p><strong>Navigation Bar:</strong> Contains controls to switch between different modules inside DLP, a dropdown button (where you will have to set paths for your caffe/build/tools, caffe/python, and python bin directory), and buttons linking to our social media pages.</p><p><strong>Function Bar:</strong> Contains controls to stop/exit your project, and ways to set your working directory and add images/classes among other things.</p><p><strong>Visualization Area:</strong> The main area where you will manipulate your images.</p><p><strong>Class Setting:</strong> Contains the number of classes defined for your classification task along with the number of images in each class.</p><p><strong>Image Setting:</strong> Contains configurable settings for your image data.</p><p>Now that we are somehow acquainted to the Data Module interface, let’s jump headfirst and start interacting with it.</p><h3>Dataset Description</h3><p>We will be using the fashion-mnist dataset. This dataset was introduced by researchers at <a href="https://jobs.zalando.com/tech/">Zalando</a>, an e-commerce company, as a drop-in replacement for the popular <a href="http://yann.lecun.com/exdb/mnist/">MNIST dataset</a>. Fashion-mnist contains images of various articles and clothing items — such as shirts, shoes, bags, coats and other fashion items — consisting of a training set of 60,000 examples and a test set of 10,000 examples. Similar to MNIST, each example is a 28x28 grayscale image associated with a <strong>label from 10 classes</strong> (t-shirts, trousers, pullovers, dresses, coats, sandals, shirts, sneakers, bags, and ankle boots). Below is an example how the data looks, where each class takes three-rows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*9AExGGG_uCEJtnm_lKpNNw.png" /></figure><h3>Get The Data</h3><p>The dataset can be downloaded from <a href="https://pan.baidu.com/s/1dGopafv"><strong>here</strong></a><strong>. </strong>The downloaded zip file, named fashion_mnist_data.tar.gz, should have the following directory structure:</p><p>&lt;training/testing&gt; / &lt;label&gt; / &lt;id&gt;.png</p><p>The training folder contains labeled png images that will be used to train our Caffe model. The testing folder contains labeled png images as well, but these images will be used to evaluate our trained Caffe model.</p><h3>Dataset Preparation</h3><p>DLP can be used to help visualizing and organizing your dataset in a very easy and intuitive way. Head back to DLP from where we left it and under the <strong>Function Bar</strong> click on <strong>AddClass</strong>, and an editable label area under the <strong>Class Setting</strong> panel will show up:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*mFsbzap5MHfOxq87RTdJEA.png" /></figure><p>From there you can give your label/class a name. Since Fashion-mnist is a 10-class dataset, we are going to repeat the above procedure 9 more times and labeled our class from 0–9:</p><p>If you pay attention to the highlighted area in the above screenshot, you will notice that there is a number between each label area and its corresponding trash icon. This number (currently 0 for all labels) indicates the number of images in each class. And since all we have done so far was just adding class label, each class label has zero image for now. For each class label, let us add the corresponding images. In order to add images corresponding to a specific class label, first click on the yellow box in front of the label area then under the <strong>Function Bar</strong> click on <strong>AddImg</strong> and navigate to the folder in your machine containing the images corresponding to the specific label you have selected under the <strong>Class Setting</strong>. For instance to add images corresponding to label 0 (T-shirt/top), within your <strong>fashion_mnist_data</strong> folder navigate to: /training/0.</p><p>You notice that the number indicating the number of images for the class label 0 has changed from 0 to 6,000. This means our dataset contains 6,000 images for this label. We do the same for the remaining classes. This is an easy and clean way to visualize and inspect your dataset; whether you want to add more images for a given class label or simply delete some images in a given class.</p><p>Now that our images are imported into DLP, we need to store them in a format that can be used to train a Caffe model.</p><p>Under the <strong>Image Setting</strong> panel -located right under the <strong>Class Setting</strong> panel- you can give a name to your dataset, set the Size option to 28x28, and the ImageType to Grayscale (since we are dealing with 28x28 grayscale images). Select PNG for the ImageEncode (since our images are all png files), and LMDB for the BackEnd. Set the TestingSet to a percentage of your choice (for instance 25) and select shuffle and MeanFile for the Parameters. You then have to give a name to the meanfile that will be generated.</p><p>Basically these settings mean that we are dealing with 28x28 grayscale images encoded into the png format, the data will first be shuffled then stored as lmdb, and 25% of the training set will be used as validation set. While creating the lmdb files for our training and validation data, we will also generate the mean image of the training data.</p><p>Once you have defined your <strong>Image Setting</strong>, you can preview your changes by clicking on the <strong>Preview</strong> command on the Function Bar. And you will notice that in the <strong>Visualization Area</strong> your images size have changed to match the size defined in the <strong>Image Setting panel</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*3VlThYz2IM80u2LVgQCN0w.png" /></figure><p>Now make sure that your <strong>/caffe/build/tools/</strong> and <strong>/caffe/python/</strong> paths are set properly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*KEFy5y3lIhwdVoUgVFZOJg.png" /></figure><p>Then proceed with the data transformation -as defined under the Image Setting panel- by heading to the Function Bar and clicking on the <strong>Convert</strong> command. You will then be asked to select a location where you will like the files -that will be generated- to be saved… and that’s it. Typically the <strong>Convert </strong>command will split your initial dataset into training and validation set, then for each dataset it will store the images as lmdb files ready to be fed to a Caffe model. The mean image of the dataset will also be generated.</p><p>If everything goes well, a “Success” window will pop up. Click ok, and then move to the network definition module by clicking on the <strong>NextStep</strong> command located on the <strong>Function Bar.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/0*x6cG1rxjTfpACP7_.png" /></figure><h3>Model Definition</h3><p>This is where you define your model architecture and its parameters. Here you can import your .prototxt train_val file into DLP, build up a net architecture from an existing architecture or from scratch using DLP <strong>Net Components</strong> in a simple drag and drop fashion, or you can simply use one of the predefined net architectures provided in DLP net library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/0*i8jbNC3e2pKvRFp3.png" /></figure><p>For this example, we will go for the latter, i.e. we will use one of the net defined in DLP net library. More specifically, we are going to use the popular LeNet architecture.</p><p>Simply left-click into the LeNet command located in the net library then drag it into the <strong>Visualization Area</strong> and drop:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/0*VPnahj0LJfivlqYa.png" /></figure><p>In the <strong>Visualization Area</strong> you will get a visualization of the LeNet architecture. Each component/layer of the net are clickable, and clicking on a specific component will allow you to define/inspect its parameters under the <strong>Component Setting</strong> panel.</p><p>We are going to modify some of the default settings for some of the LeNet components. Let’s start with the Data layers. Typically we want to modify the name associated to each data layer, specify paths to the lmdb files corresponding to the training and validation set, and include the mean file of the training data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/0*bM9Un8ZNgnMWMYL1.png" /></figure><p>We do the same for the Data layer corresponding to the validation set (the one connected to the Convolution layer). To know which lmdb file goes to which Data layer, refer to the default name given to each data layer (you can edit those names but we recommend not to).</p><p>Next we have to make sure that the output number from the last InnerProduct layer actually matches the number of classes of our classification problem, which is 10.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/0*6nLuZDxU0Hn7ZxN4.png" /></figure><p>You may have noticed this LeNet architecture contains two accuracy layers: one is to compute the accuracy for LeNet by comparing the true label to the top k scoring classes, and the other does the same thing but instead of comparing the true label to the top k scoring classes it only compares it to the top scoring class. By default k = 3, you can change the default value if you like to.</p><p>Now that our net is ready, it’s time to define its solver component. The solver is responsible for model optimization. Select the solver component and inspect and/or modify its parameters under the <strong>Component Setting</strong> panel. You can leave it to default values, or change the value of some properties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/0*1YaYDOYYfscfmOOp.png" /></figure><p>I have opted to train the model for 50 iterations, save a snapshot every 25 iterations, display the training log every 10 iterations, and validate the training on the validation set every 10 iterations as well. You can leave the “SolverMode” to CPU if you are running a CPU-ONLY Caffe, otherwise set it to GPU.</p><p>Now that we have made the appropriate changes into LeNet architecture to fit our classification problem and have defined the solver accordingly, it is now time to train our model. Click on the <strong>Train</strong> command and you will be asked to select a destination folder (that will host the generated .prototxt files and caffemodels).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/0*05CgxKwsmuhg7k_x.png" /></figure><h3>Model Training</h3><p>The <strong>Train</strong> command will direct you to DLP <strong>Train Module</strong> interface and will automatically kick start the training.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/0*hKsJGzItJN4fZTcy.png" /></figure><p>There we can monitor the training either by visualizing plots for the training/test loss, as well as plots for the model accuracies (top 1 and top 3) on the validation set, or by inspecting the log panel beneath the <strong>Visualization Area</strong>. The training logs, .prototxt files, and caffemodels will be stored inside the folder you selected when you clicked on the <strong>Train</strong> command. After 50 epochs, the top-1 accuracy on the validation set is around 72%, while the top-3 accuracy clocked at around 94%. A steady decrease in the training/validation loss can also be observed.</p><p>Now that we have trained our Caffe model, we can use it to make predictions on new (unseen) data (images from the test set, for instance).</p><h3>Prediction On New Data</h3><p>Click on the <strong>NextStep</strong> command to head to the <strong>Deploy</strong> module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/0*C_IEs48RPuUww8g3.png" /></figure><p>The Deploy module interface is rather intuitive. To start making predictions on new image data, there are a number of files we first need to prepare: a deploy.prototxt file, and a text(.txt) label file. Create a .txt file with your favorite code editor, and for each line write down the name of each of the (fashion-mnist) 10-classes in the order in which you loaded up the data on DLP. Your label.txt file should look like the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*oLl8tK3jbSaneR4LABKDNA.png" /></figure><p>The deploy_fashion-mnist.prototxt file can be downloaded from <a href="https://pan.baidu.com/s/1dGopafv"><strong>here</strong></a>. Its structure is similar to the <strong>fashion-mnist-train_val.prototxt</strong> (generated during the model definition phase) but with a few modifications. Once we have these two files ready and saved locally, we are now all set. But before we start making predictions on unseen data, we have to tell DLP where to find the following files: our label.txt and deploy_fashion-mnist.prototxt, our trained Caffe model, and the mean file generated during the data preparation phase. And if you running a CPU-ONLY Caffe, you want to make sure that the Mode option is set to CPU.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/0*mTeGsu94fM42sGkT.png" /></figure><p>If all required parameters are set, the dropdown button will turn green. Next, turn on the toggle button by dragging it to the right. This will initialize DLP for prediction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/0*9fRjBOckWjEgeTC4.png" /></figure><p>Then head to the <strong>Function Bar</strong> and click on the <strong>Image</strong> command to add an image input. The prediction to the input image will pop up at the right side of the <strong>Visualization Area</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*cBwYMX_VtoDO8ZrG.png" /></figure><p>In my case, the classifier is 100% confident that the input image is a Dress. Let’s try another input image from the test set of the fashion-mnist data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/0*R9kDJUvsB-6BeqgI.png" /></figure><p>Again, our classifier made the right prediction with a perfect confidence score.</p><h3>Conclusion</h3><p>In this tutorial, we walked through the process of training a convolution neural networks classifier using DLP. We covered DLP core modules namely, Data, Net, Train, and Deploy. From here, there are number of things you can try:</p><p>1. Train for longer: we trained our classifier for just 50 iterations. Training for a longer number of iterations will surely improve the accuracy of our classifier.</p><p>2. Try other net architectures: DLP net library contains some of the most popular (and effective) CNN architectures for classification. You can try them out.</p><p>3. Train on your own data: we used the fashion-mnist dataset to illustrate how to perform classification from data preparation to prediction on unseen data using DLP. The steps described above will be similar for any datasets used for classification.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5769a61c9304" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>