<?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 Nirojan Selvanathan on Medium]]></title>
        <description><![CDATA[Stories by Nirojan Selvanathan on Medium]]></description>
        <link>https://medium.com/@sshniro?source=rss-61185f8c9420------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*YVEh1WqeeecpCiUf.</url>
            <title>Stories by Nirojan Selvanathan on Medium</title>
            <link>https://medium.com/@sshniro?source=rss-61185f8c9420------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 04:34:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sshniro/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[APISIX as high-performance micro-gateway]]></title>
            <link>https://sshniro.medium.com/apisix-as-high-performance-micro-gateway-2fc96859bb0d?source=rss-61185f8c9420------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fc96859bb0d</guid>
            <dc:creator><![CDATA[Nirojan Selvanathan]]></dc:creator>
            <pubDate>Sat, 24 Oct 2020 09:56:56 GMT</pubDate>
            <atom:updated>2020-10-24T09:56:56.512Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*MKsYvoRtdoUncrosp1Fazw.jpeg" /></figure><p>The concept of an API Gateway has been there for several years. An API Gateway acts as the single entry point into the system. Hence, in a nutshell, all requests from clients will first go through the API Gateway, and then will be routed to the relevant service. In addition to request routing, it can perform additional duties such as, request transformations, authentication, and load balancing. Therefore this can be used either to expose your applications to the internet or inside the intranet for your microservices to communicate with each other.</p><p>Apache APISIX is built with high-performance in mind. More than a decade ago API gateways didn’t have such high- performance requirements. At that time Internet traffic mainly ran from the browser to the server, and there was less traffic from microservices or the intranet. And most of the API Gateways built at the time were limited to the technologies at that time.</p><p>However, there is a lot of traffic now, with mobile phones, IoT devices. This will keep on increasing with the introduction of 5G technologies. At the same time, the internal traffic is also getting increased with the hype of microservice architecture. Therefore in this new business situation, there are more new requirements for the API gateway.</p><p>Our team at Chain Analytica is currently using APISIX as a micro gateway for our Zilk Road Platform. Our ZilkRoad platform connects businesses to their supply chains from suppliers to logistic partners and financial partners in a unified platform with enhanced collaboration, visibility, and intelligence with the power of Industry 4.0 and blockchain.</p><p>The following is a feather cast I gave for the Apache Software Foundation on APISIX.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FNvVKuq5GUCs%3Fstart%3D4%26feature%3Doembed%26start%3D4&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DNvVKuq5GUCs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FNvVKuq5GUCs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c689e102c6cdd6a4016daa750e99196f/href">https://medium.com/media/c689e102c6cdd6a4016daa750e99196f/href</a></iframe><p>Links:</p><p>Quick start guide: <a href="https://github.com/apache/apisix/blob/master/doc/getting-started.md">https://github.com/apache/apisix/blob/master/doc/getting-started.md</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fc96859bb0d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automate Security Testing with ZAP and GitHub Actions]]></title>
            <link>https://sshniro.medium.com/automate-security-testing-with-zap-and-github-actions-421022a9e45b?source=rss-61185f8c9420------2</link>
            <guid isPermaLink="false">https://medium.com/p/421022a9e45b</guid>
            <dc:creator><![CDATA[Nirojan Selvanathan]]></dc:creator>
            <pubDate>Wed, 27 Nov 2019 09:29:25 GMT</pubDate>
            <atom:updated>2019-11-27T13:26:52.059Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zyTQKIbCfws75mpA9mpZGA.jpeg" /></figure><p>GitHub Actions now makes it easier to automate how you build, test, and deploy your projects on any platform, including Linux, macOS, and Windows. This also makes it easy to automate security testing with ZAP. Actions let you write scripts that are triggered based on <a href="https://developer.github.com/actions/creating-workflows/workflow-configuration-options/#events-supported-in-workflow-files">certain events</a> in your GitHub repo (basically any GitHub webhook event) — creating a new issue, pushing a commit, merging a pull request. Thus the workflow can be configured to scan the web application on a daily basis or after a commit and deployment of the web application.</p><h3>Getting Started</h3><p>Go to the repository and click the `Set up a workflow yourself` to create a custom workflow. Let’s configure the workflow to scan the web application on each commit to the repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yo7aUclDBXemXNsnv-LzpA.png" /></figure><p>Create a file called ‘zap.yml’ and past the following code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c080c04b044a07b7035cdf7c7e33384b/href">https://medium.com/media/c080c04b044a07b7035cdf7c7e33384b/href</a></iframe><p>The Action will use the ZAP Dockerfile to perform a `baseline scan` to the application. The ZAP Baseline scan is a script that is available in the ZAP <a href="https://github.com/zaproxy/zaproxy/wiki/Docker">Docker</a> images. It runs the ZAP spider against the specified target for (by default) 1 minute and then waits for the passive scanning to complete before reporting the results.</p><p>This means that the script doesn&#39;t perform any actual ‘attacks’ and will run for a relatively short period of time (a few minutes at most). By default, it reports all alerts as WARNings but you can specify a config file that can change any rules to FAIL or IGNORE.</p><p>Change the URL to point ZAP to your web application in the YML file. Then push a new commit to the repository and go to the Github Actions tab. You can see the Github Action is pulling the ZAP docker image from the repository and scanning the web application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YYwLGDz3kflxKpTj1yBf8g.png" /></figure><p>You can see the docker container is listing the vulnerabilities found in the application. The docker container will fail if it found any vulnerabilities defined in the baseline scan.</p><p>If you want to tweak the scanning and to perform any additional steps then use the <a href="https://github.com/zaproxy/zaproxy/blob/develop/docker/docs/scan-hooks.md">scan hooks</a> provided by ZAP. After creating the scan hooks add the code to the repository and mount it via the volumes to scan the web application.</p><p>In the next blog let’s see how we can generate a report of the vulnerabilities and to raise an issue in the Github repository.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=421022a9e45b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OWASP ZAP With GitHub Actions]]></title>
            <link>https://medium.com/zed-attack-proxy/owasp-zap-with-github-actions-cfd26ece3168?source=rss-61185f8c9420------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfd26ece3168</guid>
            <dc:creator><![CDATA[Nirojan Selvanathan]]></dc:creator>
            <pubDate>Sat, 23 Nov 2019 18:50:00 GMT</pubDate>
            <atom:updated>2019-11-23T18:54:04.288Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zyTQKIbCfws75mpA9mpZGA.jpeg" /></figure><p>Github actions have become public from 2019 onwards.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfd26ece3168" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zed-attack-proxy/owasp-zap-with-github-actions-cfd26ece3168">OWASP ZAP With GitHub Actions</a> was originally published in <a href="https://medium.com/zed-attack-proxy">Zed Attack Proxy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Would you survive the Titanic]]></title>
            <link>https://medium.com/the-why-axis/would-you-survive-the-titanic-c97b646f7f74?source=rss-61185f8c9420------2</link>
            <guid isPermaLink="false">https://medium.com/p/c97b646f7f74</guid>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Nirojan Selvanathan]]></dc:creator>
            <pubDate>Wed, 20 Dec 2017 04:06:03 GMT</pubDate>
            <atom:updated>2018-02-24T11:05:27.965Z</atom:updated>
            <content:encoded><![CDATA[<p>We all know what happened in the titanic. Spoiler Alert : Yes, Jack dies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/0*K4Qpvtghf75wr_4F." /></figure><p>You may ask do we need a machine learning to predict this ? even the next door kid knows the answer. But jokes apart can we train a machine to predict who will survive the titanic crash ?</p><p>This is an infamous <a href="https://www.kaggle.com/c/titanic">competition</a> in the <a href="https://en.wikipedia.org/wiki/Kaggle">kaggle</a> data science community. In this article we’ll try to find out the patterns and correlations inside the data and try to predict who will survive the Titanic.</p><p>Machine learning can be divided in to two main categories.</p><ol><li>Regression</li><li>Classification</li></ol><p>And you might have already guessed what we are trying to do here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/214/0*k1czZdfGZ62uggDz." /></figure><p>Yes, we are trying to predict whether you would die or survive. This falls under the classification problem. (Dead or Survived)</p><p>For this article we will use google’s Collaboratory to run the samples. <a href="https://colab.research.google.com/notebook">Collaboratory</a> is similar to google sheets where you can run and share your data science experiments. The article uses python and sci-kit learn library for the ML.</p><p>To begin anything in Machine learning we need data/ information. For this we will use the RMS Titanic dataset and lets see how the data looks like.</p><ul><li><strong>survival:</strong> Survival (0 = no; 1 = yes)</li><li><strong>class:</strong> Passenger class (1 = first; 2 = second; 3 = third)</li><li><strong>name:</strong> Name of the passenger</li><li><strong>sex:</strong> Sex</li><li><strong>age:</strong> Age of the passenger</li><li><strong>sibsp:</strong> Number of siblings/spouses aboard</li><li><strong>parch:</strong> Number of parents/children aboard</li><li><strong>ticket:</strong> Ticket number</li><li><strong>fare:</strong> Passenger fare</li><li><strong>cabin:</strong> Cabin</li><li><strong>embarked:</strong> Port of embarkation (C = Cherbourg; Q = Queenstown; S = Southampton)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/0*_qJkfzIALpMeW4Cm." /></figure><p>This is how the sample data set will look like. Let also look at the count each attribute below and see if we got all the data in place.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*n5pMy8J815Ggb444." /></figure><p>From a glance we can see some data are missing. The cabin number age and some other fields are missing. We all know the golden rule.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*w2cqrUv6oGNPIVFp." /></figure><p>But for this we need to make some assumptions and fill the missing data or we need to remove those data points. As the data has very few records (2000) throwing away data is not an option. So lets try to fill the missing age with the average age from the data set.</p><p>We can see the data set has numbers and strings (letters). To put things in to perspective the machine learning algorithms understands number well (not all though).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/0*TnxLzqj_qrNDLSV-." /></figure><p>The “sex” and “embarked” fields are both string values that correspond to categories (i.e “Male” and “Female”) so we will run each through a preprocessor. This preprocessor will convert these strings into integer keys, making it easier for the classification algorithms to find patterns. For instance, “Female” and “Male” will be converted to 0 and 1 respectively.</p><p>The “name” and “ticket” columns consist of non-categorical string values. These are difficult to use in a classification algorithm, so we will drop them from the data set. The algorithm will have a hard time figuring out connection between Allen, Miss. Elisabeth Walton and Allison, Master. Hudson Trevor. With a small data set it is hard to derive the social class using the names.</p><p><strong>The fun part — Classification with Decision trees</strong></p><p>Lets do a very basic classification algorithm. This will try to build a decision tree based on the data set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/0*7hxSVveLtWI8ju3n." /></figure><p>The tree first splits by sex, and then by class, since it has learned during the training phase that these are the two most important features for determining survival. The dark blue boxes indicate passengers who are likely to survive, and the dark orange boxes represent passengers who are almost certainly doomed. Interestingly, after splitting by class, the main deciding factor determining the survival of women is the ticket fare that they paid, while the deciding factor for men is their age (with children being much more likely to survive).</p><p>To create this tree, we first initialize a decision tree classifier. (Here we will set the maximum depth of the tree to 10). Next we “fit” this classifier to our training set, enabling it to learn about how different factors affect the survivability of a passenger. Now that the decision tree is ready, we can “score” it using our test data to determine how accurate it is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/0*ZNm50AHcNxYLVsXq." /></figure><p>The dt.score states the accuracy of the predictions which is 78%.</p><h3>Lets get more technical</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/0*wRZfwcTVJeU7zRP3." /></figure><p>Data science will look not cool if we don’t use some technical words. So lets build a random forest classifier and see if we can improve the accuracy ? Lets not get in to the math but simply put random forest is many decision trees built using random samples and each decision tree votes on the final results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/0*fhtn90HOoUjQ1CZf." /></figure><p>So lets say we make 3 decision trees and 2 says that a person dies and 1 decision trees say that person will survive then we can conclude that the person definitely dies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/0*1jP3wXawGbeX-1QS." /></figure><p>With a few lines of code we can implement this and now the accuracy has improved to 88%. OOB stands for out of the bag score.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/0*VvKsC3_A-29AjQ6U." /></figure><p>Lets get in a neural network and find if we can improve the accuracy. Some would say it is an overkill to use a neural network with such little data. But lets try out and see.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/0*hoA3HbMrZWTcdj5F." /></figure><p>With just the basic setup we are able to get a 78% accuracy.</p><p>So how can we improve it more, for starters we can tweak the ML algorithms and try to enhance the results a bit, we can also do something called feature engineering. Feature engineering is where we can bring our human insights to enrich the data. For example remember we dropped the names saying its too hard to compute, but we can write a method to identify the social classes based on their salutations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/0*qrZYdFm4u-1K9UB5." /></figure><p>By introducing more feature engineering we can improve the accuracy to a certain extent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/284/0*KnVJpagFxhZN1k9e." /></figure><p>Yes, cant we achieve 100% accuracy ?</p><p>It will be really hard in this scenario because of the outliers. For example we can take the Allison’s family. Although the machine learning algorithm states they will survive but in actual case they did not make it. The ML says almost 96% of the wealthy women has survived so how did this happen ?</p><p>It turns out that the Allison family was unable to find their youngest son Trevor and was unwilling to leave the ship without him.</p><p>From the results we can see there is a strong correlation in the data and women and children have a strong chance of surviving. But this would be a different case if this happened in 2016 with LGBT and transgender movements.</p><h3>So Whats Next ?</h3><p>The article was intended to provide a stepping stone in to the data science world. From here you can fine tune the machine learning models and try to implement new machine learning models to evaluate the accuracies. And can apply these learning to other interesting data sets in the Kaggle community.</p><p><em>Originally published at </em><a href="https://whyaxis.me/2017/12/20/would-you-survive-the-titanic/"><em>whyaxis.me</em></a><em> on December 20, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c97b646f7f74" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-why-axis/would-you-survive-the-titanic-c97b646f7f74">Would you survive the Titanic</a> was originally published in <a href="https://medium.com/the-why-axis">The Why Axis</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scrum for Weddings]]></title>
            <link>https://sshniro.medium.com/scrum-for-weddings-e3a32cf15e57?source=rss-61185f8c9420------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3a32cf15e57</guid>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[scrum]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[wedding-planning]]></category>
            <dc:creator><![CDATA[Nirojan Selvanathan]]></dc:creator>
            <pubDate>Thu, 26 Oct 2017 11:59:28 GMT</pubDate>
            <atom:updated>2018-02-24T12:36:52.069Z</atom:updated>
            <content:encoded><![CDATA[<p>You might be wondering why I’m listing down the wedding under personal projects. Because wedding nowadays have become more into a fancy multi million dollar project. When we think of wedding these days, this would be the picture on most people’s mind.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/0*q7D4C5C4J7qTzwoq." /></figure><p>Now lets see what is a project is, it must have a dead line, scope and a cost. Same here! , Once you picked a date for your wedding, that’s it ! you are running against the clock.</p><p>There is a saying in Tamil culture, ‘if you want to see how hard life is either try to build a house or try to do wedding’. Doing a wedding seems very hectic , but for me it was two weddings because we are from two different cultures. For people who knows Sri Lankan history will understand. Basically doing a wedding between two cultures that were in war for 30 years takes it to another whole new dimension. And I always joke around people saying that I had two weddings , but bride for both the weddings were the same person. 😀</p><p>Weddings will always end up in scope crepe, so there should be a way to manage all these nonsense. And yes, the answer is Scrum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*HrXi8mdhlrCwmQ_j." /></figure><p>Scrum is an Agile framework for completing complex projects. Scrum originally was formalized for software development projects, but it works well for any complex work. But how does it fit into a traditional wedding.</p><p>As all projects, wedding also initiate with the initial requirement docs. But in Indo Asian culture the initial documents you need to start a wedding is your zodiac documents. Normally both sides will have an expert consultant (astrologer) to predict the outcomes and you’ll end up in very confusing predictions. 😀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/0*B01sW73OIDZHq37l." /></figure><p>After the initial sow (statement of work) we can begin the planning. In scrum there are some key concepts.</p><p>One of the first things to do when we start a scrum project is to have a product backlog. For this scenario the product is our wedding. backlog is all the features that you want in your wedding. And we’ll be implementing these features based on the priority and break it in to small sprints which are time boxed. For weddings, with my personal experience I would recommend having 1 week sprints.</p><p><strong>Priorities matter</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*khb8VRaTiFI3x43u." /></figure><p>Lets say you have two features/(User stories), which is to book the wedding venue and to book the wedding catering service. With out booking the wedding hall we cannot book the catering service, because some wedding halls does not allow private catering. So always prioritize the features from the backlog and take the most important things to the coming sprints.</p><p>For the scrum project I added my wife as the product owner, and I assume I don’t need to elaborate more on this fact I assume. I was playing the scrum master role. The team members were my parents , siblings and friends etc.</p><p>I will not bore you with the <a href="http://stephenwalther.com/archive/2012/08/17/scrum-in-5-minutes">process</a> and terminologies, but I’ll jot down some pain points when applying scrum to a wedding.</p><p><strong>Daily stands up , use proper medium.</strong></p><p>In scrum we have some thing called daily stand up where the whole team meets every day for a quick status update. Its always better to have daily stand ups to keeps every one in sync. It’s acceptable that all the team members can’t be present for daily stand up. But always try to get hold of them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/170/0*mclMbTwOHzd9kKCL." /></figure><p>And always use a common medium where every one can relate to. It took me an eternity to explain what is a Skype/Viber to my parents. In Sri Lankan context I would recommend to go with conference calls.</p><p><strong>Have a cross functional team</strong></p><p>A cross-functional team has members with a variety of skills. In the team one person might be an expert in traditional customs and one might be good at handling finances. So always create a self organized cross functional team. In other words the Team is self-managing; overseeing its own internal workings, rather than being told from external management what to do and when to do it.</p><p>For example the tradition expert should play his part and disseminate their knowledge for the other members. For example in the Sinhalese tradition the parents provide a glass of water and after that only we can eat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/223/0*Frol4alHqpwnGINW." /></figure><p>You are not supposed to drink it. We have to touch the glass and go for the lunch. But guess what happened. Yes there were people who drank the water.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*qM4HUUVFxLYBhfOP." /></figure><p>So both parties should understand the customs.</p><p><strong>Defining user stories that every one can understand matters.</strong></p><p>User stories are short, simple descriptions of a feature told from the perspective of the person who wants the new feature. So for printing the wedding invitation I would write the user story as, “As a groom, I want to print the invitation cards so I can handover it to my relatives.” and will add the template as the brief description.</p><p>Even for the well defined wedding cards also there can be small misunderstandings. This is what I gave for the sample text, and this was my expectation. I basically wanted the hand sign to be there.</p><p>Long story short the regular typist was not there, so a new person did this and guess what I got as the sample print.</p><p>This is why it is always important to have well defined user stories that every one can understand. And always have the risk measured when involving 3rd parties.</p><p><strong>Remove uncertainties with a POC</strong></p><p>Most of the things revolve around weddings are based on uncertainties. We are uncertain if the food will be good on the wedding day etc. So its always better to do a poc (proof of concept) before making any decisions. For the food I tested almost all the catering services in Colombo. 😀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/0*Lwqmu0hBHEem16VU." /></figure><p>And believe me they are more than happy to give some samples. So its always better to do a proof of concept before trying to go a decision based on high level of uncertainty.</p><p><strong>Retrospective meetings are more emotional.</strong></p><p>Retrospective meetings are held in the end of each sprint and discusses on what happened in the sprint and identifies actions for improvement going forward.The retro respective meetings before the wedding will be always troublesome, but the final retrospective meeting that you would have, after the wedding day would be the most interesting.</p><p>Wedding present atrocities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/265/0*gj127r7Zl-MfmtbZ." /></figure><p><strong>Having an everlasting impression</strong>.</p><p>After the project completions also people should always remember how awesome is it. For me I had a wedding location that no one can even imagine to have it now, at any cost. Because the whole building <a href="https://www.youtube.com/watch?v=OtVKIBQ2hec">collapsed</a> down recently this year.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*T23cPOWtjj-sULZK." /></figure><p>So always choose the location wisely.</p><p>That’s all folks. And thanks for all the friends and family for the help and guidance.</p><p><em>Originally published at </em><a href="https://whyaxis.me/2017/10/26/scrum-for-sri-lankan-weddings/"><em>whyaxis.me</em></a><em> on October 26, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3a32cf15e57" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a table top hologram projector]]></title>
            <link>https://sshniro.medium.com/building-a-table-top-hologram-projector-1b76b69e44dc?source=rss-61185f8c9420------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b76b69e44dc</guid>
            <category><![CDATA[hologram]]></category>
            <category><![CDATA[diy]]></category>
            <dc:creator><![CDATA[Nirojan Selvanathan]]></dc:creator>
            <pubDate>Sun, 01 Oct 2017 05:07:54 GMT</pubDate>
            <atom:updated>2018-02-24T12:56:11.884Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I was interested in building a hologram projector to view the restaurant menu in 3D. This quest began when I ordered some fancy named food in the restaurant and ended up having rice and some boiled vegetables for dinner. 😀 . So basically that got me thinking is there a more cool way to display the food in 3D and make the experience more appealing.</p><p>The below image is one of the commercial grade hologram projectors in the markets priced from (2000$- 8000$). In technical terms in not a true hologram projector but an illusion of reflection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/0*dV69HZxnij1lDN83." /></figure><p>In this article I’ll talk about how to make something similar and the challenges on the way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/431/0*lDzIU1FohzQvn75F." /></figure><p>The above image shows the final device built. In this article I’m going to talk about the technical difficulties I faced when building this hologram projector.</p><p>1. The Material to use.</p><p>There were specialized hologram glasses commercially available but I could not get a hold of those from Sri Lanka. So initially I resorted with a CD cover. But using such material did not give a good look. Then I resorted to mirrors, but those are very fragile. I wanted something transparent and strong, and finally found that magic material,which is perspex glass.</p><p>2. The lighting condition.</p><p>One of the biggest problems of making a commercially viable hologram projector is the lighting condition. In order to get the holographic look the glass(pyramid) should be transparent as possible. But when the glass is fully transparent for even a small surround light, the hologram fully disappears. So the solution is to use a tint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/0*y9qCtZBEsXiCafQ-." /></figure><p>This astonishing effect will get lost if the brightness of the surrounding light increases. So it’s hard to keep these devices in a fully lighted environment.</p><p>3. How much tint to use ?</p><p>First I wanted fully tint the glass, so i bought a perspex sheet with almost 80% tint, which means 20% transparent , and from the video you can see the effect, it works like a black mirror.</p><p>The appealing nature of the hologram comes when the glasses are more transparent , but at this point it’s like watching a mirror. And I could not find a perspex sheet with 20% transparency so I got the car window tint sheet and pasted on the perspex and it was very effective. We were able to observe the hologram in normal lighting conditions too.</p><p>4. So how does the commercial hologram projectors solve this issue ?</p><p>They also use this selective tinting and they use specialized perspex/glass made for this exact purpose. Some tackle the issue by designing the hologram stand in a way that will give less light inside the pyramid. Some have added spotlight inside the pyramid and used tint in the range of 80%. The spotlight tactic is good for product marketing (show case a product in 3D etc).</p><p>The below image shows a commercial hologram projector. It uses slightly tinted glass and a spotlight from the top to tackle the lighting issue.The hologram projector also uses the structure of the device to gain more artificial darkness.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/0*SiCR63xRifIA6ulr." /></figure><p>5. The height (View Area / Height of the pyramid).</p><p>Another main problem is the height of the hologram projector. If you want a considerable view angle then you must use a display similar to 42 inches. So if we want to make a tabletop version then the view area will be really small because of the way the pyramid should be placed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/0*c_NBDlD3f-A6TgtO." /></figure><p>From the above image you can see how much of a space it consumes to give a proper view-able angle. To tackle this issue I ignored the best angle for the pyramid and made a bigger pyramid and I morphed the video so the reflection will be good in the pyramid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/0*MFhqhK8ybUrk7xNN." /></figure><p>Adobe premier pro was used for the boot strapping works. The following video will show how to create a simple holographic video with the help of Adobe premier pro. In addition to that, I have used the 3D option in the adobe premier pro to slant the video in the z axis (12 degrees) so when it is projected in the high slanted pyramid it will look in a normal way without any distortions.</p><p>6. How do we make the pyramid ?</p><p>As I used the perspex glass I initially tried cutting the glass manually, but that ended up in an imperfect finish. Then I resorted to laser cutting. I drew the template shown below in a corel-draw file and used the laser to soften the edges and finally bend the glass to form the pyramid. Correct laser specs should be used, other wise we’ll end up burning the material.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/195/0*WhTKCxpHCeL1kQ25." /></figure><p>7. How do we control what is projected in the pyramid.</p><p>For simplicity we used a mobile app to change the projection from the top display. We used a tab as the display option, but for cost benefits we can use a simple led display which is controlled by the raspberry pie.</p><p>8. How do we make the structure that holds the pyramid and the display ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/0*1KBXsZkkWpTIs9Vu." /></figure><p>The above image shows the blue print of the hologram stand. Thick perspex glass was used to provide extra stability to the stand.</p><p>So these are the lessons I learnt by making the hologram projector for commercial use. If you have any questions please reach me out at sshniro AT gmail.com</p><p>This is the final promo video we took for the hologram projector.</p><p><em>Originally published at </em><a href="https://whyaxis.me/2017/10/01/building-a-table-top-hologram-projector/"><em>whyaxis.me</em></a><em> on October 1, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b76b69e44dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a simple Neural Network with Keras and Tensorflow]]></title>
            <link>https://sshniro.medium.com/building-a-simple-neural-network-with-keras-and-tensorflow-b1be3703a356?source=rss-61185f8c9420------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1be3703a356</guid>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Nirojan Selvanathan]]></dc:creator>
            <pubDate>Thu, 14 Sep 2017 11:28:54 GMT</pubDate>
            <atom:updated>2018-02-24T12:57:05.371Z</atom:updated>
            <content:encoded><![CDATA[<p>Neural networks have been a hot topic after the surfacing of deep learning. In these series of tutorials we will go in depth into building complex networks with Keras and Tensor Flow.</p><p>TensorFlow is an open-source library for machine learning introduced by Google. Keras provides a high level api/wrapper around TensorFlow.</p><p>In this tutorial we’ll look into building a very simple neural network in Keras and use Tensor Flow as the backend. You can follow the installation of Tensorflow in this <a href="https://www.tensorflow.org/install/">page</a>. Using the virtualenv is recommended to minimize dependency and version conflicts.</p><p>For this tutorial we will implement a simple XOR (exclusive OR) logic in a Neural Network. XOR is an interesting thing because it is not a linearly separable problem. We cannot draw a single linearly separable line between these nodes. For this let’s look at a very simple example. As you are a shop owner you have 4 customer segments and you want a method to segment these customer. For your business high earning old people and middle earning young people are the most loyal customers and you are planning to provide some discounts for these segments. So is there a way we can draw a single line to divide the high return customers and low return customers. This is exactly the same scenario in XOR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/213/0*5A1luZnq8TwSADxb." /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/217/0*jscykV3_xPbsUrsT." /></figure><p>So how can we solve this with Neural Network (NN). Let’s start by importing the packages we need to build the NN.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/0*tE1ufdca9Cyd8hUq." /></figure><p>The python environment is good with scientific computing and math related work. So we import numpy. Numpy is a python library which makes array manipulations very easy and keras internally supports numpy arrays as inputs.</p><p>There are two different API’s provided by Keras, which are Functional and Sequential models. We will import the simplest model which is the sequential model. This can be seen as a linear stack of layers. These Neural networks consist of different layers where input data flows through and gets transformed on its way. There are several layers provided by Keras (Dense , Dropout and merge layers). These different types of layer help us to model individual kinds of neural nets for various machine learning tasks. In our scenario we’ll be needing only the Dense layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/0*9dKK1lU3JuYmDScD." /></figure><p>The initial input will be created as a two dimensional array. The target (output) array is also two dimensional but contains just a single output.</p><p>Input Input Output Old [0] Middle Income [0] Non Loyal Customers [0] Young [1] Middle Income [0] Loyal Customers [1] Old [0] High Income [1] Loyal Customers [1] Young [1] High Income [1] Non Loyal Customer [0]</p><p>Now the interesting part begins, creating the model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/0*a60WLNmHNPJGaiz4." /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/0*RDX90QohZ6yVNuLa." /></figure><p>As mentioned before we’ll be using the dense layer. The first parameter states the number of neurons in that given layer and the second parameter states the number of inputs given to the model. Lets not get too much worried about this activation function, will talk about this in a while. After this we add a second layer which has only one neuron. Have you noticed that input dimension is not stated in the second layer , because it internally takes the 1st layer as the input to the final layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/0*kEB2YI4VAOtJtSfy." /></figure><p>In this we have used two types of activation functions which is ReLU (Rectified linear unit) and a Sigmoid function. Just like our neurons in our head these neurons also needs to be activated to pass the message to next neuron. Similar to that these activation functions also has some threshold and when it meets the threshold it fires(activates) the neuron.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/0*dvt8Csv3t0JH2bH-." /></figure><p>The last thing to do is to compile the model. In order to compile we need two things. In order to the NN to set the correct weights to the model we need to tell the model how well is it performing. This is knows as the loss (how bad it performed). To this we will pick mean_squared_error as the loss function.</p><p>The second factor is the optimizing function. The job for the optimization function is to find the right numbers to the weights and thus reducing the loss. For the optimization we will use something called adam optimizer.</p><p>You might ask are these the only loss or optimization function I can use. No ! . Even if we add binary_crossentropy as the error function the NN will work without a hassle. But that does not mean all the error functions can be used interchangeably. A process of trial and error should be done master which fits in to which scenarios.</p><p>The third parameter is to measure the accuracy. In here we’ll use binary_accuracy to calculate the accuracy of the predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/0*OL5LTV4-VIJpjUs-." /></figure><p>Finally we start the training process by calling the fit function. Now we can see in 54th iteration we are getting the 100% accuracy. If we run it several times the convergence number will slightly change because the weights are initialized randomly for the first iteration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/0*swC5gI6I4Oinci5i." /></figure><h3>Tweaking the model.</h3><p>Okay we have built a very simple neural network so can we tweak it. We can visualize what we have built is some thing similar to the below image. So what are the things we can change in this neural network ?</p><p><strong>Increasing the number of hidden layers</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/0*b9y8ksS1baGVtqFM." /></figure><p>Let’s try with adding another hidden layer and check if we get to 100% accuracy very quickly. So how do we add a new layer ? . Simple we just append another single line to the model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/0*nkmP7TfJTqZjLC-3." /></figure><p>The results are really good. We were able to get 100% with the 11th Iteration it self.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/0*Ce6N85Uv98kGYxbk." /></figure><p>Now lets have only one hidden layer and increase the number of neurons in the first layer and see whether the accuracy increase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/0*n_EaEfj0Ot6jgkTE." /></figure><p>Oh ! this has increased the iteration count to reach 100% accuracy. We saw previously with 16 neurons we were able to converge in the 55th interactions , but now it took 86 iterations to converge with 32 neurons in a layer. So increasing the number of neurons does not always yield in good results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/0*U7URouO3ZHpCZzes." /></figure><p>Through these tutorial I basically wanted to convey the message that, we don’t have to be a mathematician in order to build machine learning models or do machine learning. A basic understanding of how things works would be enough to get you started. In contrast for machine learning theory you’ll be needing a more in depth math knowledge. Lets see you in the next tutorial and solve some more interesting problems.</p><p><em>Originally published at </em><a href="https://whyaxis.me/2017/09/14/building-a-simple-neural-network-with-keras-and-tensorflow/"><em>whyaxis.me</em></a><em> on September 14, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1be3703a356" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A GPU Based Real Time People Re-identification Inside a Came Network]]></title>
            <link>https://sshniro.medium.com/a-gpu-based-real-time-people-re-identification-inside-a-came-network-a9a68131655b?source=rss-61185f8c9420------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9a68131655b</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Nirojan Selvanathan]]></dc:creator>
            <pubDate>Tue, 18 Jul 2017 12:43:51 GMT</pubDate>
            <atom:updated>2018-02-24T12:36:19.684Z</atom:updated>
            <content:encoded><![CDATA[<p>This article is about our final year project which dates back to 2015 AD, to re-identify people inside a camera network. Basically at the end of the day if you point a person in the CCTV and ask where did that person go it will generate a video of the person wandering around.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/237/0*Y3Jtr0xZ-BhGUr0U." /></figure><p>Okays not as worse as the sponge bob re-identification. But yea it works. And yes the system runs real time too.</p><p>The following video shows the system running. That’s a very long video I would suggest to keep on reading. 😀</p><p>The video below shows the final footage of the re-identified people. The system re-identifies most of the people. In some scenarios it identifies people with the same color dress which appear in the same time frame. (The last person in the video footage with black color t-shirt)</p><h4>Lets get in to some technical details shall we ?</h4><p>1. So how do we detect the humans in the CCTV footage ?</p><p>Before we try to detect the human we need to figure out the moving parts. For that we used the <a href="https://whyaxis.wordpress.com/2015/12/29/background-substraction-with-mog/">background subtraction technique</a>. So basically we take several continuous frames and analyse what are the things which are moving and what are the things which stays still. This helps us to come up with a rectangular area which includes the moving object. (blobs)</p><p>2. What will be the issues when detecting the moving objects inside a camera network ?</p><p>Yes the opening of the doors (rotating fans, moving shadows) will be also captured as the foreground.</p><p>This is another problem where a group of people will be identified as one single blob.</p><p>As we can see, as the persons dress or skin color almost matches the floor color it classifies those parts as the background too. So we might get moving blobs with missing body parts.</p><p>3. How do we eliminate these non human blobs ?</p><p>Train a support vector machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/0*-g0AeR_cjaSDf-40." /></figure><p>The below image shows how a person is detected with the help of SVM.(Please do refer the documentation for more info)</p><p>4. Now we have identified the moving objects, now how do we re-identify a person ?</p><p>Easy , face recognition. Hmm that’s what we though also. 😀</p><p>But because of the very low video quality of the footages it is infeasible to do a face recognition. So we used the Network graph and color moments to re-identify a person. When a person(blob) leaves a camera node the identified profile with the color moments will be sent to the adjacent nodes. And if a person appears in the next adjacent camera with similar profile with in the time limit then the person will be given the same profile.</p><p>5. Okay, so what is this color moment that we are talking about ?</p><p>Utilizing Body Proportions to define regions in the image and extract the color features in that area. (HSV color model)</p><p>6. Okay, but when extracting the color in the rectangular area how can remove the non human part in the rectangular area ?</p><p>Simple, use a convex hull to remove the background from the rectangular area. Please do refer documentation for implementation details.</p><p>7. As CCTV cameras have very low resolution and quality how to process the video ?</p><p>Use a noise removal technique on the videos. We used a bilateral filter on the video frames. The image below shows an edge detection done on the sample low quality the first one with out any enhancements and the second one with bilateral filter. We can clearly see in the second image the edges are more clear and easier to segment.</p><p>8. What were some interesting problems that were faced ?</p><p>OH My god the Mirrors. Not the <a href="https://www.youtube.com/watch?v=uuZE_IRwLNI">Justin Timberlake’s mirror</a>, but the usual mirror. In some footages there are mirror that reflect the person in-front. And those mirror images also started to get classified as humans and profiled for re-identification.</p><p>As you can see from the video there is a green line marked. If a blob is detected completely inside this marked region then it will be removed and will not be considered as a valid profile.</p><p>9. Why use a GPU is it a lame reason to play games ?</p><p>Okay we admit it, we played Bio Shock , GTA and all sort of things. But we did that only for the purpose of testing the GPU. 😀 .And after 2 months we were convinced that was a good GPU.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/0*Z5iuaMEnzb9koCwP." /></figure><p>And the second reason is with all the above mentioned computation it is very hard to run more than 4 video parallel in a CPU (Desktop i5). So we ended up parallelizing the several components of the system and compiled the open-cv to support cuda to enhance the system.</p><p>Above video shows the same system running only with the CPU (4 cores) to show the performance gain. The system struggles to run in real time and crashes in few seconds and the CPU usage reaches the full utilization level.</p><p>10. What are the lessons we learnt ?</p><p>Never use c++. Unless you have a c++ expert in your team. Period. 😀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/0*s7YCMF-zIE6pc9mp." /></figure><p>11. Why is the UI so crappy ?</p><p>To this question I like to quote the Nokia CEO.</p><p>Okays we accept it , we failed. But before you judge us you need know that there is so much things going inside the UI for showing the videos parallel. Feed synchronization has been done show the videos in parallel.</p><p>Although the videos are processed parallely the CPU is used to show the feed, so some videos(less complex videos without many humans) process fast and some takes time to process, so we needed to synchronize and there started the race condition and all sort of things. (All the videos must start processing at the same time and all should wait until the last video frame gets processed and move to the other one)</p><p>12. How can we improve the system to achieve more than 80% accuracy ?</p><p>Hire a CCTV operator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/0*pEaKdv5kvz0bCCPg." /></figure><p>Okay, jokes apart. The color moment can be improved. For example we can use watershed algorithm etc. This enhances the re-identification capability of the system.</p><p>13. What are some of the challenges observed ?</p><ul><li>Very low lighting conditions.</li><li>The camera network is different for every building</li></ul><p>14. So what is different from other related projects ?</p><p>There are different implementations. This is our approach by using color moments , with out going to rich feature and network graph which runs in real time with the utilization of the GPU. We were able to run upto 28 videos parallel with out a single delay.</p><p>Limitations.</p><ul><li>We do not provide re-identification for aerial views. Its very hard to compare bald heads. 😀 . Planning to do a thesis in this domain. 😀</li><li>System does not support multiple levels of footage. (1st floor, 2nd floor etc)</li><li>System does not support overlapping video footage.</li></ul><p>Technologies used.</p><ul><li>C ++</li><li>Open CV for image processing</li><li>CUDA for parallel processing</li><li>QT for UI</li><li>Visual Studio for code editing</li></ul><p>Project Link — <a href="https://docs.google.com/document/d/1WlC-iF_d3PbUapWs7FYxZIL9MwLb7-lGwceezOw0oRM/edit?usp=sharing">Google doc link</a></p><p><em>Originally published at </em><a href="https://whyaxis.me/2017/07/18/a-gpu-based-real-time-people-re-identification-inside-a-came-network/"><em>whyaxis.me</em></a><em> on July 18, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9a68131655b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>