tag:blogger.com,1999:blog-86509720562391065302024-02-19T19:06:32.214+05:30My WorkFew chunks of my virtual worldpihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.comBlogger101125tag:blogger.com,1999:blog-8650972056239106530.post-54892298550991642822014-11-05T17:42:00.002+05:302014-11-05T17:51:18.622+05:30Time Delay Estimation Techniques - Part 2
<a href="http://pi19404.github.io/pyVision/2014/10/19/TODA2/">Time Delay Estimation Techniques - Part 2</a>
follow the link or view the article below
<div dir="ltr" style="text-align: left;" trbidi="on">
<iframe height="800" src="http://pi19404.github.io/pyVision/2014/10/19/TODA2/" width="900"></iframe></div>pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-58071308639631228912014-10-13T02:04:00.001+05:302014-10-13T02:04:12.585+05:30Time Delay Estimation Techniques
<iframe width="100%" frameborder="0" src="http://pi19404.github.io/pyVision/2014/10/13/TDOA1.html" height="400"></iframe>
pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-58445654039679588912014-10-07T21:23:00.001+05:302014-11-05T18:03:18.901+05:30Discrete Fourier Transform For Freuency Analysis<div dir="ltr" style="text-align: left;" trbidi="on">
<iframe height="800" src="http://pi19404.github.io/pyVision/2014/10/11/DFT1/" width="900"></iframe></div>
pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-55694263279787443642014-10-07T18:02:00.002+05:302014-10-07T18:12:12.270+05:30Jekyll - Static Website Generator<p> </p>
<div class="entry">
<h2 id="introduction">Introduction</h2>
<p>In this article we will look at <strong>Jekyll</strong> static site generator to generate a static website and host the same on <strong>github</strong> using github pages.</p>
<h2 id="background">Background</h2>
<p>Jekyll is a simple, blog aware, static site generator.</p>
<p>A static site generator is a utility that generates ready-to-publish static HTML pages from a set of files usually in markdown or HTML which are suitable for deployment directory on any web-server .The blog-aware means that it can support and maintain website with content added in series like that of blogs.</p>
<p>Jekyll is the engine behind GitHub Pages, which enables us to use Jekyll to host the project’s page, blog, or website from GitHub’s servers for free</p>
<h2 id="github-pages-and-jekyll-installation">Github Pages and Jekyll Installation</h2>
<p>Let us consider the github project <a href="https://github.com/pi19404/pyVision">www.github.com/pi19404/pyVision.</a></p>
<p>Github pages generator gives us the facility to create a website for the project using one of the standard defined themes .This is the easiest way to start a project without having to worry about the HTML themes and CSS files etc and just focus on content writing.</p>
<p>To generate a static webpage of the project go to project settings on github.com <img alt="enter image description here" src="https://googledrive.com/host/0B-pfqaQBbAAtbExWN0Zya3JySzA/ss5.png" /> Click on the <strong><em>Automatic page generator</em></strong> options</p>
<p>This will provide you with a markdown editor where you can enter the contents for the main page of the website.</p>
<p>Enter the name ,content and other details and click on <strong><em>“Continue to Layouts Button”</em></strong> to proceed to HTML theme selection <img alt="enter image description here" src="https://googledrive.com/host/0B-pfqaQBbAAtbExWN0Zya3JySzA/ss6.png" /> Select the desired theme and click on <strong><em>“Publish Page”</em></strong> button to complete the process <img alt="enter image description here" src="https://googledrive.com/host/0B-pfqaQBbAAtbExWN0Zya3JySzA/ss7.png" /> This will lead to github servers hosting the created website on “http://pi19404.github.io/pyVision”</p>
<p>now we are ready to modify and edit the website.The sources of the website are also stored in github repository of the project in the gh-pages branch.</p>
<p>Thus all we have to do to access the sources is to checkout the gh-pages branch and start modifying content on local server and then push changes onto remote github repository.The github servers will regenerated the website and latest changes will be reflected on your website.</p>
<p>The same process can be used to maintain blogs,post or any other content of the website.</p>
<p>Every GitHub Page is run through Jekyll when you push content to gh-pages branch within your repository</p>
<h2 id="installing-jekyll">Installing Jekyll</h2>
<p>Though Jekyll installation on local PC is not necessary.It can be installed in order to preview the website and troubleshoot issues or bugs before pushing the site on GitHub Pages.</p>
<ul>
<li>Ruby - Jekyll requires the Ruby version 1.9.3 or higher.
<ul>
<li>To install ruby easiest way is to download ruby install managers like <strong><em>“rvm - The Ruby Version Manager”</em></strong></li>
<li>Detailed installation instruction for <code>rvm</code> can be found at <a href="http://rvm.io/rvm/install">http://rvm.io/rvm/install</a> or install the software from package manager like synaptic</li>
<li>To install Ruby : <code>rvm install 1.9.3</code></li>
<li>This will download the ruby 1.9.3 sources and perform compilation and deployment at “/usr/share/ruby-rvm/”</li>
<li>In some cases you many encounter compilation issues due to outdated version of OpenSSL,in which case install the openssl from rvm tool : <code>rvm pkg install openssl</code></li>
<li>This will install the openssl packaged within the rvm installation directory</li>
<li>
<p>While compiling ruby we can given commandline arguments so that it referes the openSSL package from the rvm install directory and not default system path :</p>
<p><code>rvm install 1.9.3 --with-openssl-dir=/usr/share/ruby-rvm/usr</code></p>
</li>
</ul>
</li>
<li>
<p>Bundler - Bundler is a package manager ,This can be installed as easily</p>
<p><strong>gem install bundler</strong></p>
</li>
<li>Jekyll installation
<ul>
<li>Clone the sites repository on the local machine</li>
<li>Change the branch to gh-pages if you have created a project website</li>
<li>
<p>Create a file called GemFile in the directory with the following content</p>
<pre>
<code> source 'https://rubygems.org'
gem 'github-pages'
</code></pre>
</li>
<li>Run the command : <code>bundle install</code> for installing Jekyll</li>
<li>
<p>To ensure that local development environment is same as that of github regularily update the local environment</p>
<p><code>bundle update github-pages </code></p>
</li>
</ul>
</li>
<li>Running Jekyll : <code>bundle exec jekyll serve</code> The website is accessible for preview at : http://localhost:4000</li>
</ul>
<h2 id="layouts-and-website-template">Layouts and Website Template</h2>
<p>Front-matter is just a set of metadata, delineated by three dashes which takes for form of valid YAML content.Any file that contains a front matter block will be processed by Jekyll as a special file. Thus .Jekyll requires that Markdown files have front-matter defined at the top of every file.The front matter can be included in top of markdown or HTML files.</p>
<p>Between the dashed lines you can set predefined variables ( title,layout) or set custom used defined variables.</p>
<p>The present article was written using Markdown syntax and frontmatter included on top of the files was</p>
<pre class="brush:html">
---
layout: post
title: Jekyll A Static Website Generator
---
Introduction
-------------
In this article we will look at **Jekyll** static site generator to generate a static website and host the same on **github** using github pages.</pre>
<p>The layout tag specifies the template to be used for generating posts.The templates can be makrdown containing HTML contents.</p>
<p>Jekyll uses the <a href="https://github.com/shopify/liquid/wiki/liquid-for-designers">Liquid template system</a> .The variables defined in front matter and page contents can be accessed accessed using the Liquid tags both within the files as well as any layouts that page of post relies on.</p>
<p>Let us look at the template for post called <strong>post.html</strong> and how contents are incorporated using Liquid markup language</p>
<pre class="brush:html">
---
layout: default
---
<article class="post">
<h1>{{ page.title }}</h1>
<div class="entry">
{{ content }}
</div>
<div class="date">
Written on {{ page.date | date: "%B %e, %Y" }}
</div>
</article>
</pre>
The layout tag specifies the template to be used for generating posts.The templates can be markdown containing HTML contents. Jekyll uses the [Liquid template system](https://github.com/shopify/liquid/wiki/liquid-for-designers).The variables defined in front matter and page contents can be accessed accessed using the Liquid tags both within the files as well as any layouts that page of post relies on. Let us look at the template for post called **post.html** and how contents are incorporated using Liquid markup language
<p>Thus when a post is created using the template,then the title specified in the frontmatter is the post is accessed via variable page.title.The page content is accessed via variable content. Jekyll provides numerous predefined global variables that you can set in the front matter of a page or post.</p>
<p>Information on some of them can be found at <a href="http://jekyllrb.com/docs/frontmatter/#predefined-global-variables">Frontmatter Predefined variables</a></p>
<p>The rendered html output for above file is</p>
<p><img alt="enter link description here" src="https://googledrive.com/host/0B-pfqaQBbAAtbExWN0Zya3JySzA/ss8.png" /></p>
<p>we have seen that in <strong>post.html</strong> file we have included frontmatter <strong>“layout”</strong>.This enables us to include the contents of the post.html file into another files as its contents using Liquid markup language.</p>
<p>This enables us to maintain layout and content files separately and we can change the site layout whenever required without making any changes to the content files.The frontmatter predefined variable provides a lot of flexibility in how we can define complex layouts and themes for the website.</p>
<p>There is a <strong>index.html</strong> file in the project repository that is auto generated by github pages. We modify this file so that it can be used as a base template for all the pages on the website.</p>
<p>we create a <code>_layouts</code> directory in the root folder of the repository.This directory contains all the files that can be accessed by defining the <code>layout</code> variable in the frontmatter of the files.If the layout variable is assigned values post then the file post.html in the _layout directory will be accessed.</p>
<p>we create a file default.html.The default.html file contains the html headers,javascript,stylesheets etc as well as contents to be included in header and footer of pages. Again Liquid markup language is used to specify where the content is be be included</p>
<pre class="brush:html">
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>pyVision by pi19404</title>
<link rel="stylesheet" href="/stylesheets/styles.css">
<link rel="stylesheet" href="/stylesheets/pygment_trac.css">
<script src="javascripts/scale.fix.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
</head>
<body>
<div class="wrapper">
<header>
........
</header>
<section>
{{ "{{" }} content }} <!----- contents inserted here --->
</section>
</div>
<footer>
.......
</footer>
</body>
</html>
</pre>
<p>If the file is markdown file then all its contents are inserted in place of contents tag.If the file is HTML then the declaration inside section tag of class content is inserted in place of contents tag.All the pages of the website including the main page index.html contains frontmatter are designed so that generated contents are inserted within default layout.</p>
<h2 id="posting-blog">Posting Blog</h2>
<p>All the blog posts reside in the <code>_posts</code> directory.The format of filename is <strong>year-month-day-title.ext</strong>.This will generate the blogs posts in year/month/day directory of static website. The blog posts can be html or markdown .</p>
<p>Let us create a blog post called 2014-10-03-Jekyll.md</p>
<pre class="brush:ruby">
---
layout: post
title: Jekyll A Static Website Generator
---
Introduction
-------------
In this article we will look at **Jekyll** static site generator to generate a static website and host the same on **github** using github pages.
........
</pre>
<p>Now we need to provide links to access the blog content from the main page of website.This is done using Jekyll variables and adding the below content in the <strong>index.html</strong> page</p>
<pre class="brush:ruby">
---
layout: default
---
<section class="content">
<section>.......</section>
<ul class="entries">
<li>Blog Posts -{{ "{{" }} site.url }}</li>
<li>{{ for post in site.posts %}}</li>
<li>
<h3><a href="{{ post.url | remove_first:'/'}}">{{ post.title }}</a></h3>
</li>
<li>{{ endfor %}}</li>
</ul>
</section></pre>
<p>now we launch the website on local machine by executing command</p>
<p><code>bundle exec jekyll serve</code></p>
<p><img alt="enter image description here" src="https://googledrive.com/host/0B-pfqaQBbAAtbExWN0Zya3JySzA/ss9.png" /></p>
<p>now we push the repository onto github</p>
<p><code>git push origin gh-pages</code></p>
<p>access the webpage and observe the similar output as on local server</p>
<p>The markdown used is called <code>GitHub Flavored Markdown</code>,It is different from standard markdown language.The following like gives the difference and highlights the features of <a href="https://help.github.com/articles/github-flavored-markdown/">Github Flavored markdown</a> language</p>
<p>now that we have created the html,say we want to use the html content on other sites like codeproject or blogger.we can access the html at _site/posts/2013/10/03/Jekyll.html.</p>
<p>Thus we can simply create blog article with content in markdown in suitable directory and not worry about layout rendering and other issues.The same approach can be used for generating any page of website.</p>
<h2 id="code">Code</h2>
<p>The pyVision repository can be found at <a href="http://www.github.com/pi19404/pyvision"><code>www.github.com/pi19404/pyvision</code></a> and the website is hosted at <a href="http://pi19404.github.io/pyVision/">pyvision</a> All the files used in the present article can be found in the gh-pages branch of the repository.</p>
<p>The file for the present article can be found at <strong>_posts/2014-10-03-Jekyll.md</strong></p>
<p><strong>The files can also be downloaded from </strong></p>
<ul class="download">
<li><a href="826515/pyVision.rar">Download pyVision.rar - 1.5 MB</a></li>
<li><a href="826515/pyVision.zip">Download pyVision.zip - 1.6 MB</a></li>
<li><a href="https://github.com/pi19404/pyVision/releases/download/pyVision/pyVision_ghpages.rar">Alternate link</a></li>
</ul>
<p> </p></div>pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-77411222442971829312014-10-07T03:09:00.000+05:302014-10-07T03:09:11.663+05:30Python Project Documentation Using Sphinx<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="color: #333333; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
<span style="font-family: inherit;"><br class="Apple-interchange-newline" />Introduction</span></h2>
<div style="color: #111111; font-size: 14px;">
<span style="font-family: inherit;">In this article we will look at how to uses <strong style="border: 0px; margin: 0px; padding: 0px;">Sphinx</strong> <span style="background-color: white; border: 0px; color: black; margin: 0px; padding: 0px;"> documentation builder for documenting python project.</span></span></div>
<h2 style="color: #333333; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
<span style="font-family: inherit;">Background</span></h2>
<div style="color: #111111; font-size: 14px; text-align: left;">
<span style="background-color: white; border: 0px; color: black; margin: 0px; padding: 0px;"><span style="font-family: inherit;">Code document is essential for a project .It increases the usability of code are make it appealing for use to wide range of users.It is a neccessary tool for developer working in opensource or enterprise software projects.</span></span></div>
<div style="color: #111111; font-size: 14px; text-align: left;">
<span style="background-color: white; border: 0px; color: black; margin: 0px; padding: 0px;"><span style="font-family: inherit;"><br /></span></span></div>
<div style="color: #111111; font-size: 14px; text-align: left;">
<span style="font-family: inherit;"><span style="border: 0px; color: black; font-size: small; margin: 0px; padding: 0px;"><strong style="border: 0px; margin: 0px; padding: 0px;">reStructuredText</strong> is an easy-to-read, plaintext markup syntax and parser system.</span><span style="border: 0px; color: black; font-size: small; margin: 0px; padding: 0px;">The primary goal of reStructuredText is to define and implement a markup syntax for use variety of documentation domains.The advantage is that markup language is readable and simple, yet powerful enough to provide the ability to convert reStructuredText documents into useful structured data formats .</span></span></div>
<div style="color: #111111; font-size: 14px; text-align: left;">
<span style="border: 0px; color: black; font-size: small; margin: 0px; padding: 0px;"><span style="font-family: inherit;"><br /></span></span></div>
<div style="color: #111111; font-size: 14px; text-align: left;">
<span style="font-family: inherit;"><span style="background-color: white; border: 0px; color: black; margin: 0px; padding: 0px;"><strong style="border: 0px; margin: 0px; padding: 0px;">Sphinx</strong> uses </span>reStructuredText<span style="background-color: white; border: 0px; color: black; margin: 0px; padding: 0px;"> as its markup language, and is a tool to translate a set of </span><strong style="border: 0px; margin: 0px; padding: 0px;">reStructuredText </strong><span style="background-color: white; border: 0px; color: black; margin: 0px; padding: 0px;"> source files into various output formats like </span><span style="background-color: white; border: 0px; color: black; margin: 0px; padding: 0px;">HTML and LaTeX.</span></span></div>
<div style="color: #111111; font-size: 14px; text-align: left;">
<span style="background-color: white; border: 0px; color: black; margin: 0px; padding: 0px;"><span style="font-family: inherit;"><br /></span></span></div>
<div style="color: #111111; font-size: 14px; text-align: left;">
<span style="font-family: inherit;"><span style="background-color: white; border: 0px; color: black; font-size: 16px; line-height: 20.799999237060547px; margin: 0px; padding: 0px; text-align: justify;">The current standard tool for documenting python documents is by using </span><strong style="border: 0px; color: black; margin: 0px; padding: 0px;">Sphinx</strong><span style="background-color: white; border: 0px; color: black; font-size: 16px; line-height: 20.799999237060547px; margin: 0px; padding: 0px; text-align: justify;">.</span></span></div>
<div style="color: #111111; font-size: 14px; text-align: left;">
<span style="font-family: inherit;"><span style="background-color: white; border: 0px; color: black; font-size: 16px; line-height: 20.799999237060547px; margin: 0px; padding: 0px; text-align: justify;"><strong style="border: 0px; margin: 0px; padding: 0px;">Sphinx</strong> supports automatic generation of module or package documentation based on parsing function headers and extracting doc strings.Such doc strings are typically referred to as </span><em style="background-color: white; border: 0px; color: black; font-size: 16px; line-height: 20.799999237060547px; margin: 0px; padding: 0px; text-align: justify;">API documentation</em></span></div>
<div style="color: #111111; font-size: 14px; text-align: left;">
<em style="background-color: white; border: 0px; color: black; font-size: 16px; line-height: 20.799999237060547px; margin: 0px; padding: 0px; text-align: justify;"><span style="font-family: inherit;"><br /></span></em></div>
<div style="color: #111111; font-size: 14px; text-align: left;">
<span style="font-family: inherit;"><span style="background-color: white; border: 0px; color: black; font-size: 16px; line-height: 20.799999237060547px; margin: 0px; padding: 0px; text-align: justify;">There are two principal steps in making API documentation. First, write doc strings in all key classes, methods, and functions using the formatting options defined by Sphinx and second is configuring and using </span><strong style="border: 0px; color: black; font-size: 16px; line-height: 20.799999237060547px; margin: 0px; padding: 0px; text-align: justify;">Sphinx</strong><span style="background-color: white; border: 0px; color: black; font-size: 16px; line-height: 20.799999237060547px; margin: 0px; padding: 0px; text-align: justify;"> for document generation.</span></span></div>
<h2 style="color: #333333; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
<span style="font-family: inherit;">Python Docstrings</span></h2>
<div style="text-align: left;">
<span style="font-family: inherit;">Python documentation strings (or docstrings) provide a convenient way of associating documentation with Python modules, functions, classes, and methods.<br /><br />It is a good programming practice to Write docstrings for all public modules, functions, classes, and methods.Docstrings for private modules can be skipped ,however including comments or docstrings as developer notes is always helpful.<br /><br />A lot of references can be found online describing the format of generic python docstring and good programming and documentation practice like<a href="http://legacy.python.org/dev/peps/pep-0008/#documentation-strings"> http://legacy.python.org/dev/peps/pep-0008/#documentation-strings</a> or <a href="http://legacy.python.org/dev/peps/pep-0257/">http://legacy.python.org/dev/peps/pep-0257/</a><br /><br />Sphinx uses numpy docstring format.A standard guide to numpy/scipy docstring format can be found at <a href="https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt">https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt</a><br /><br /><br />NumPy, <a href="http://www.scipy.org/">SciPy</a>, and the scikits follow a common convention for docstrings that provides for consistency, while also allowing the toolchain to produce well-formatted reference guides.The docstring standard uses <a href="http://docutils.sourceforge.net/rst.html">re-structured text (reST)</a> syntax and is rendered using <a href="http://sphinx.pocoo.org/">Sphinx</a><br /><br />The are numerous docstring,here we mention only the important once which are freuently used in numpy/scipy documentation</span></div>
<h3 style="color: #ff9900; font-size: 19px; font-weight: normal; text-align: left;">
<span style="font-family: inherit;">Function Docstring</span></h3>
<span style="font-family: inherit;">A documentation string (docstring) is a string that describes a module, function, class, or method definition. The docstring is a special attribute of the object that can be accessed by (object.__doc__) and is surrounded by triple double quotes .</span><br />
<div style="color: #111111; font-size: 14px;">
<span style="background-color: white; border: 0px; color: #333333; font-size: 16px; line-height: 25.600000381469727px; margin: 0px; padding: 0px;"><span style="font-family: inherit;"><br /></span></span></div>
<div style="color: #111111; font-size: 14px;">
<b><span style="font-family: inherit;">For example</span></b></div>
<pre lang="Java" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;">def compute(self,input):
""" function computes the output of the hidden layer for input matrix """
</pre>
<h3 style="color: #ff9900; font-size: 19px; font-weight: normal;">
<span style="font-family: inherit;">Parameters Docstring</span></h3>
<div>
<span style="font-family: inherit;">Parameter docstring contains the description of the function arguments, keywords and their respective types.For example</span><br />
<pre lang="Java" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;">Parameters
----------
input : numpy array,shape=(N,n_in)
:math:`h_{i-1}(x)` is the `input`
</pre>
<div style="color: #111111; font-size: 14px;">
<span style="font-family: inherit;"><br /></span></div>
<span style="font-family: inherit;">The input variable and associated type and desciption are mentioned. </span><br />
<h3 style="color: #ff9900; font-size: 19px; font-weight: normal;">
<span style="font-family: inherit;">Returns Docstring</span></h3>
<span style="font-family: inherit;">Contains the explanation of the returned values and their types.Name of return variable is optional</span><br />
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;">Returns
-----------
output : numpy array,shape=(N,n_out)
:math:`f(b_k + w_k^T h_{i-1}(x))`</pre>
<h2 style="color: #333333; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
<span style="font-family: inherit;">Latex Math</span></h2>
<span style="font-family: inherit;">numpydoc docstring format which is used by Sphix allows us to use latex math expression <br /><br />An way to include inline math is shown in examples in Parameter and Returns Docstring sections.It contains a specifier ":math:" followed by the math expression in back-uotes.<br /><br />To include math equations in seperate line we can use</span><br />
<div class="highlight-rst" style="background-color: white; border: 0px; font-size: 16px; margin: 0px; padding: 0px;">
<div class="highlight" style="background: rgb(238, 255, 204); border: 0px; margin: 0px; padding: 0px;">
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;">:math:`f(b_k + w_k^T h_{i-1}(x))`</pre>
</div>
</div>
<div style="background-color: white; font-size: 16px; line-height: 20.799999237060547px; text-align: justify;">
<span style="font-family: inherit;">or</span></div>
<div class="highlight-rst" style="background-color: white; border: 0px; font-size: 16px; margin: 0px; padding: 0px;">
<div class="highlight" style="background: rgb(238, 255, 204); border: 0px; margin: 0px; padding: 0px;">
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;">.. math::
f(b_k + w_k^T h_{i-1}(x))</pre>
</div>
</div>
<div style="color: #111111; font-size: 14px;">
<span style="font-family: inherit;"><br /></span></div>
<span style="font-family: inherit;">There are various other docstring like Raises,See Also,Notes,References,Examples,warning.Refer the following link to get more information on the same <a href="https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt">https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt</a></span><br />
<br />
The sample output generated by sphinx for the function is shown below<br />
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;"> def compute(self,input):<br />
"""function computes the output of the hidden layer for input matrix
Parameters
---------
input : numpy array,shape=(N,n_in)
:math:`h_{i-1}(x)` is the `input`
Returns
-----------
output : numpy array,shape=(N,n_out)
:math:`f(b_k + w_k^T h_{i-1}(x))
"""
#performs affine transformation over input vector
linout=numpy.dot(self.W,input.T)+np.reshape(self.b,(self.b.shape[0],1));
#applies non linear activation function over computed linear transformation<br />
self.output=self.activation(linout).T;
return self.output;</pre>
<br />
<dt id="MLPHiddenLayer.HiddenLayer.compute" style="background-color: #f8f8f8; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); color: #222222; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.2em; margin: 1.5em 0px; padding: 10px;"><tt class="descname" style="background-color: transparent; font-size: 1.2em; font-weight: bold;">compute</tt><big>(</big><em>input</em><big>)</big><a class="reference internal" href="https://draft.blogger.com/_modules/MLPHiddenLayer.html#HiddenLayer.compute" style="color: #2878a2; text-decoration: none; word-wrap: break-word;"><span class="viewcode-link" style="float: right;">[source]</span></a><a class="headerlink" href="https://draft.blogger.com/blogger.g?blogID=8650972056239106530#MLPHiddenLayer.HiddenLayer.compute" style="color: #c60f0f; font-size: 0.8em; padding: 0px 4px; text-decoration: none; visibility: hidden; word-wrap: break-word;" title="Permalink to this definition"></a></dt>
<dd style="background-color: white; color: #1d1f22; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 21.599998474121094px; margin-bottom: 10px; margin-left: 30px; margin-top: 3px;"><div style="line-height: 1.5em; margin-bottom: 0.1em; margin-top: 1.2em;">
function computes the output of the hidden layer for input matrix</div>
<table class="docutils field-list" frame="void" rules="none" style="background-color: transparent; border-collapse: collapse; border-spacing: 0px; border: 0px; margin-bottom: 10px; max-width: 100%;"><colgroup><col class="field-name" style="background-color: #f0f7fa;"></col><col class="field-body"></col></colgroup><tbody valign="top">
<tr class="field-odd field" style="background-color: #f0f7fa; border-color: rgb(221, 221, 221); border-style: solid none; border-width: 1px 0px;"><th class="field-name" style="border: 0px !important; padding: 1px 8px 1px 5px; white-space: nowrap;">Parameters:</th><td class="field-body" style="background-color: white; border: 0px rgb(221, 221, 221) !important; padding: 1px 8px 1px 5px;"><div class="first" style="line-height: 1.5em; margin-bottom: 0.1em; margin-top: 1.2em;">
<strong>input</strong> : numpy array,shape=(N,n_in)</div>
<blockquote>
<div style="line-height: 1.5em; margin-bottom: 0.1em; margin-top: 1.2em;">
<span class="math"><span class="MathJax_Preview" style="color: #888888;"></span><span aria-readonly="true" class="MathJax" id="MathJax-Element-2-Frame" role="textbox" style="border: 0px; direction: ltr; display: inline; float: none; font-size: 14px; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; padding: 0px; white-space: nowrap; word-spacing: normal; word-wrap: normal;"><nobr style="-webkit-transition: none; border: 0px; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; padding: 0px; transition: none; vertical-align: 0px;"><span class="math" id="MathJax-Span-47" style="-webkit-transition: none; border: 0px; display: inline-block; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 3.854em;"><span style="-webkit-transition: none; border: 0px; display: inline-block; font-size: 17px; height: 0px; margin: 0px; padding: 0px; position: relative; transition: none; vertical-align: 0px; width: 3.213em;"><span style="-webkit-transition: none; border: 0px; clip: rect(1.812em 1000.003em 3.154em -0.464em); left: 0.003em; margin: 0px; padding: 0px; position: absolute; top: -2.74em; transition: none; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-48" style="-webkit-transition: none; border: 0px; display: inline; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;"><span class="msubsup" id="MathJax-Span-49" style="-webkit-transition: none; border: 0px; display: inline; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;"><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 0px; margin: 0px; padding: 0px; position: relative; transition: none; vertical-align: 0px; width: 1.754em;"><span style="-webkit-transition: none; border: 0px; clip: rect(1.637em 1000.003em 2.687em -0.464em); left: 0.003em; margin: 0px; padding: 0px; position: absolute; top: -2.506em; transition: none; vertical-align: 0px;"><span class="mi" id="MathJax-Span-50" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Math-italic; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">h</span><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 2.512em; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 0px;"></span></span><span style="-webkit-transition: none; border: 0px; left: 0.586em; margin: 0px; padding: 0px; position: absolute; top: -2.04em; transition: none; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-51" style="-webkit-transition: none; border: 0px; display: inline; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-52" style="-webkit-transition: none; border: 0px; display: inline; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;"><span class="mi" id="MathJax-Span-53" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Math-italic; font-size: 12px; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">i</span><span class="mo" id="MathJax-Span-54" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Main; font-size: 12px; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">−</span><span class="mn" id="MathJax-Span-55" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Main; font-size: 12px; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">1</span></span></span><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 2.22em; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 0px;"></span></span></span></span><span class="mo" id="MathJax-Span-56" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Main; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">(</span><span class="mi" id="MathJax-Span-57" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Math-italic; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">x</span><span class="mo" id="MathJax-Span-58" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Main; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">)</span></span><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 2.746em; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 0px;"></span></span></span><span style="-webkit-transition: none; border-left-style: solid; border-width: 0px 0px 0px 0.003em; display: inline-block; height: 1.323em; margin: 0px; overflow: hidden; padding: 0px; position: static; transition: none; vertical-align: -0.344em; width: 0px;"></span></span></nobr></span></span> is the <cite style="font-style: normal;">input</cite></div>
</blockquote>
</td></tr>
<tr class="field-even field" style="background-color: #fdfdfd; border-color: rgb(221, 221, 221); border-style: solid none; border-width: 1px 0px;"><th class="field-name" style="background-color: #f0f7fa; border: 0px !important; padding: 1px 8px 1px 5px; white-space: nowrap;">Returns:</th><td class="field-body" style="background-color: white; border: 0px rgb(221, 221, 221) !important; padding: 1px 8px 1px 5px;"><div class="first" style="line-height: 1.5em; margin-bottom: 0.1em; margin-top: 1.2em;">
<strong>output</strong> : numpy array,shape=(N,n_out)</div>
<blockquote class="last">
<div style="line-height: 1.5em; margin-bottom: 0.1em; margin-top: 1.2em;">
<span class="math"><span class="MathJax_Preview" style="color: #888888;"></span><span aria-readonly="true" class="MathJax" id="MathJax-Element-3-Frame" role="textbox" style="border: 0px; direction: ltr; display: inline; float: none; font-size: 14px; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; padding: 0px; white-space: nowrap; word-spacing: normal; word-wrap: normal;"><nobr style="-webkit-transition: none; border: 0px; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; padding: 0px; transition: none; vertical-align: 0px;"><span class="math" id="MathJax-Span-59" style="-webkit-transition: none; border: 0px; display: inline-block; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 9.34em;"><span style="-webkit-transition: none; border: 0px; display: inline-block; font-size: 17px; height: 0px; margin: 0px; padding: 0px; position: relative; transition: none; vertical-align: 0px; width: 7.823em;"><span style="-webkit-transition: none; border: 0px; clip: rect(1.754em 1000.003em 3.271em -0.464em); left: 0.003em; margin: 0px; padding: 0px; position: absolute; top: -2.74em; transition: none; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-60" style="-webkit-transition: none; border: 0px; display: inline; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;"><span class="mi" id="MathJax-Span-61" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Math-italic; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">f<span style="-webkit-transition: none; border: 0px; display: inline-block; height: 1px; margin: 0px; overflow: hidden; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 0.061em;"></span></span><span class="mo" id="MathJax-Span-62" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Main; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">(</span><span class="msubsup" id="MathJax-Span-63" style="-webkit-transition: none; border: 0px; display: inline; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;"><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 0px; margin: 0px; padding: 0px; position: relative; transition: none; vertical-align: 0px; width: 0.82em;"><span style="-webkit-transition: none; border: 0px; clip: rect(1.637em 1000.003em 2.687em -0.464em); left: 0.003em; margin: 0px; padding: 0px; position: absolute; top: -2.506em; transition: none; vertical-align: 0px;"><span class="mi" id="MathJax-Span-64" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Math-italic; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">b</span><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 2.512em; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 0px;"></span></span><span style="-webkit-transition: none; border: 0px; left: 0.411em; margin: 0px; padding: 0px; position: absolute; top: -1.864em; transition: none; vertical-align: 0px;"><span class="mi" id="MathJax-Span-65" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Math-italic; font-size: 12px; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">k</span><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 2.045em; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 0px;"></span></span></span></span><span class="mo" id="MathJax-Span-66" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Main; margin: 0px; padding: 0px 0px 0px 0.236em; position: static; transition: none; vertical-align: 0px;">+</span><span class="msubsup" id="MathJax-Span-67" style="-webkit-transition: none; border: 0px; display: inline; margin: 0px; padding: 0px 0px 0px 0.236em; position: static; transition: none; vertical-align: 0px;"><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 0px; margin: 0px; padding: 0px; position: relative; transition: none; vertical-align: 0px; width: 1.228em;"><span style="-webkit-transition: none; border: 0px; clip: rect(1.87em 1000.003em 2.687em -0.522em); left: 0.003em; margin: 0px; padding: 0px; position: absolute; top: -2.506em; transition: none; vertical-align: 0px;"><span class="mi" id="MathJax-Span-68" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Math-italic; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">w</span><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 2.512em; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 0px;"></span></span><span style="-webkit-transition: none; border: 0px; clip: rect(1.403em 1000.003em 2.22em -0.522em); left: 0.703em; margin: 0px; padding: 0px; position: absolute; top: -2.39em; transition: none; vertical-align: 0px;"><span class="mi" id="MathJax-Span-69" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Math-italic; font-size: 12px; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">T<span style="-webkit-transition: none; border: 0px; display: inline-block; height: 1px; margin: 0px; overflow: hidden; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 0.061em;"></span></span><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 2.045em; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 0px;"></span></span><span style="-webkit-transition: none; border: 0px; clip: rect(1.403em 1000.003em 2.22em -0.464em); left: 0.703em; margin: 0px; padding: 0px; position: absolute; top: -1.689em; transition: none; vertical-align: 0px;"><span class="mi" id="MathJax-Span-70" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Math-italic; font-size: 12px; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">k</span><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 2.045em; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 0px;"></span></span></span></span><span class="msubsup" id="MathJax-Span-71" style="-webkit-transition: none; border: 0px; display: inline; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;"><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 0px; margin: 0px; padding: 0px; position: relative; transition: none; vertical-align: 0px; width: 1.754em;"><span style="-webkit-transition: none; border: 0px; clip: rect(1.637em 1000.003em 2.687em -0.464em); left: 0.003em; margin: 0px; padding: 0px; position: absolute; top: -2.506em; transition: none; vertical-align: 0px;"><span class="mi" id="MathJax-Span-72" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Math-italic; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">h</span><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 2.512em; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 0px;"></span></span><span style="-webkit-transition: none; border: 0px; left: 0.586em; margin: 0px; padding: 0px; position: absolute; top: -2.04em; transition: none; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-73" style="-webkit-transition: none; border: 0px; display: inline; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-74" style="-webkit-transition: none; border: 0px; display: inline; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;"><span class="mi" id="MathJax-Span-75" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Math-italic; font-size: 12px; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">i</span><span class="mo" id="MathJax-Span-76" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Main; font-size: 12px; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">−</span><span class="mn" id="MathJax-Span-77" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Main; font-size: 12px; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">1</span></span></span><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 2.22em; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 0px;"></span></span></span></span><span class="mo" id="MathJax-Span-78" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Main; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">(</span><span class="mi" id="MathJax-Span-79" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Math-italic; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">x</span><span class="mo" id="MathJax-Span-80" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Main; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">)</span><span class="mo" id="MathJax-Span-81" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Main; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">)</span></span><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 2.746em; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 0px;"></span></span></span><span style="-webkit-transition: none; border-left-style: solid; border-width: 0px 0px 0px 0.003em; display: inline-block; height: 1.531em; margin: 0px; overflow: hidden; padding: 0px; position: static; transition: none; vertical-align: -0.483em; width: 0px;"></span></span></nobr></span></span></div>
</blockquote>
</td></tr>
</tbody></table>
</dd><br />
<h2 style="color: #333333; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
<span style="font-family: inherit;">Installation and Configuration</span></h2>
<span style="font-family: inherit;">Since Sphinx is written in the Python language,Thus atleast python version 2.6 is required.<br /><br /><b>For Ubuntu OS </b><br /><br />Easiest way to Install python,numpy,scipy packages are synaptic package manager<br />NumpyDocs :easy_install numpydoc<br />Pillow : pip install Pillow<br />sudo apt-get install python-matplotlib<br />apt-get install python-sphinx or easy_install sphinx<br /><br />To generate documentation run sphinx-apidoc utility</span><br />
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;">sphinx-apidoc -o docs project_dir -F </pre>
<div>
<span style="font-family: inherit;"><br /></span></div>
<span style="font-family: inherit;">will generate the files required for document generation in the docs directory.The source files are referred from the project_dir path.</span></div>
<div>
<span style="font-family: inherit;"><br /></span>
<br />
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;">cd docs
make html</pre>
<div style="color: #111111; font-size: 14px;">
<span style="font-family: inherit;"><br /></span></div>
<span style="font-family: inherit;">the make command will generate the html documentation in the _build/html directory.The main page can be accessed by opening the index.html file .</span><br />
<h4 style="color: #111111; font-size: 16px;">
<span style="font-family: inherit;">Configuration</span></h4>
<span style="font-family: inherit;">To enable numpydoc format docstring as well as latex math euations some additional configurations needs to be performed.<br /><br />Go to the docs directory and open the config.py file in any document editor<br /><br />Add or Modify the command to contain the path of the source directory.</span></div>
<div>
<span style="font-family: inherit;"><br /></span>
<br />
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;">sys.path.insert(0, os.path.abspath('project_dir'))</pre>
<span style="font-family: inherit;"><br />If the above command is not present,the sphix document builder will be unable to find the python file and generate blank documentation.<br /><br />The next change reuired is to add extensions.Locate the extensions keyword in the document and modify it as below to add extensions for math,numpydocs ,autodoc,doctest etc</span><br />
<div style="color: #111111; font-size: 14px;">
<span style="font-family: inherit;"><br /></span></div>
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;">extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'matplotlib.sphinxext.mathmpl',
'matplotlib.sphinxext.only_directives',
'matplotlib.sphinxext.plot_directive',
'sphinx.ext.mathjax',
'numpydoc',
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
]</pre>
<div style="color: #111111; font-size: 14px;">
<span style="font-family: inherit;"><br /></span></div>
<div style="color: #111111; font-size: 14px;">
<span style="font-family: inherit;"><br /></span></div>
<span style="font-family: inherit;">The file also contains the information like "project name" ,author name ,copyright information which can be modified </span><br />
<div style="color: #111111; font-size: 14px;">
<span style="font-family: inherit;"><br /></span></div>
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;">project = 'PyVision'
copyright = u'2014, pi19404'
version = '0.0.1'
release = '0.0.1'
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'colorful'</pre>
<span style="font-family: inherit;"><br />There are also a host of options for html formatting<br /><br />just run make html in the docs directory for changes to reflect and regenerate all the documentation<br />A <b>html</b> themes directory is taken from <b>scikit-learn </b>source just for demonstration purposes<br />The following documentation is used for pyVision - python machine learning library project.</span><br />
<h2 style="color: #333333; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
<span style="font-family: inherit;">Code</span></h2>
<span style="font-family: inherit;">The source code for the project can be found at github repository <a href="http://www.github.com/pi19404/pyVision">www.github.com/pi19404/pyVision</a><br />The doc/api directory contains the code documentation</span></div>
<div>
<span style="font-family: inherit;"><br />To generate the documentation for the project go to the api directory and run the command "make html"</span></div>
<div>
<span style="font-family: inherit;"><br />you can access the documentation by opening the pyVision/docs/api/_build/html/index.html file in the browser</span></div>
<div>
<span style="font-family: inherit;"><br />The html template files have been taken from scikit-learn documentation directory . Documentation of some of the files may be incomplete.<br /><br />The entire project source can be found at below link</span><br />
<ul class="download" style="border: 0px; color: #111111; font-size: 14px; margin: 25px 0px 10px; padding: 0px 0px 0px 40px;">
<li style="background-attachment: scroll; background-clip: initial; background-image: url(http://dj9okeyxktdvd.cloudfront.net/images/download24.png); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat; background-size: initial; border: 0px; font-weight: bold; list-style-type: none; margin: 0px 0px 6px -40px; padding: 0px 0px 1px 30px; vertical-align: middle;"><a data-cke-saved-href="https://github.com/pi19404/pyVision/archive/pyVision.zip" href="https://github.com/pi19404/pyVision/archive/pyVision.zip" style="border: 0px; color: purple; margin: 0px; padding: 0px;"><span style="font-family: inherit;">Download pyVision.zip - 4.1 KB</span></a></li>
</ul>
</div>
</div>
pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-53185541744332323082014-10-07T02:12:00.000+05:302014-10-07T02:31:38.372+05:30Git Subtree<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="color: #333333; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px; text-align: left;">
<h2 style="font-family: 'Segoe UI', Arial, sans-serif; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
Introduction</h2>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
In this article we will look at how to use Git Subtree Tool to split a sub-directories of a project into separate project</div>
<h2 style="font-family: 'Segoe UI', Arial, sans-serif; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
Git Subtree</h2>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
It often happens that while working on a project,you need to reference another project within it.It may be sources of a third party library or a that particular submodule needs to be treated as seperate project .</div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
Subtrees allow subprojects to be included within a subdirectory of the main project, optionally including the subproject's entire history .</div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
git subtree feature enables user to either Merge subtrees together or split repository into subtrees</div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
Let us consider the repository OpenVision that can be found at www.github.com/pi19404/OpenVision</div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
let us say we want to extract the directory ImgML/pyVision as a separate project.</div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
First step is to clone the OpenVision repository on local PC</div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); color: black; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;"><strong style="border: 0px; margin: 0px; padding: 0px;">git clone https://github.com/pi19404/openVision.git</strong></pre>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
Then create the new repository on the local PC</div>
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); color: black; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;"><strong style="border: 0px; margin: 0px; padding: 0px;">mkdir pyVision
cd pyVision</strong></pre>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
Initialize a empty git repository and associate it with remote repository on github</div>
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); color: black; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;"><strong style="border: 0px; margin: 0px; padding: 0px;">git init --bare
git remote add origin https://github.com/pi19404/pyVision.git
git push -u origin master</strong></pre>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
now we have two independent repositories.</div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
in the parent repository we run the git subtree split command to create a subtree</div>
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); color: black; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;"><strong style="border: 0px; margin: 0px; padding: 0px;">git subtree split --prefix ImgML/PyVision --annotate="(pyVision)" -b pyVision</strong>
Created branch 'pyVision'
c28961fc63dbeb964955ef50b6d84b63de1d4094
now we create a remote repository
<strong style="border: 0px; margin: 0px; padding: 0px;">https://github.com/pi19404/pyVision.git
and now we push the subtree changes onto the remote repository using subtree push command
</strong>git subtree push --prefix=ImgML/PyVision pyVision master
git push using: pyVision master
Username for 'https://github.com': pi19404
Password for 'https://pi19404@github.com':
Counting objects: 43, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (43/43), done.
Writing objects: 25% (11/43), 21.11 MiB | 50.00 KiB/s
Writing objects: 100% (43/43), 24.78 MiB | 26.00 KiB/s, done.
Total 43 (delta 18), reused 0 (delta 0)
remote: warning: GH001: Large files detected.
remote: warning: See http://git.io/iEPt8g for more information.
remote: warning: File MLP.pyvision1 is 54.42 MB; this is larger than GitHub's recommended maximum file size of 50 MB
To https://github.com/pi19404/pyVision
* [new branch] ae84838a2975d3a51efbab7f7c0fbcb94783c056 -> master
</pre>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
now we commit the changes in pyVision repository to remote github.we can see all the files committed in the parent repository along with the github history present in the new repository</div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<div class="commit commit-tease js-details-container" style="background: rgb(230, 241, 246); border-color: rgb(183, 199, 207) rgb(183, 199, 207) rgb(216, 230, 236); border-style: solid; border-top-left-radius: 3px; border-top-right-radius: 3px; border-width: 1px; box-sizing: border-box; color: #111111; font-family: Helvetica, arial, freesans, clean, sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 13px; line-height: 18.200000762939453px; margin: 0px; padding: 0px;">
<div class="commit-title " style="border: 0px; box-sizing: border-box; color: #4e575b; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; line-height: normal; margin: 0px; padding: 0px;">
<div style="color: #111111;">
<a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" style="background: transparent; border: 0px; box-sizing: border-box; color: #4e575b; margin: 0px; padding: 0px; text-decoration: none;" title="parent commit1">parent commit1</a></div>
</div>
<div class="commit-meta" style="background: rgb(255, 255, 255); border-top-color: rgb(216, 230, 236); border-top-style: solid; border-width: 1px 0px 0px; box-sizing: border-box; margin: 0px; padding: 8px;">
<div style="font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; line-height: normal;">
<a class="sha-block" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" data-pjax="" href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; float: right; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; margin: 0px; padding: 0px; text-decoration: none;">latest commit <span class="sha" style="border: 0px; box-sizing: border-box; color: #444444; margin: 0px; padding: 0px;">ae84838a29</span></a></div>
<div class="authorship" style="border: 0px; box-sizing: border-box; color: #999999; font-size: 12px; margin: 0px; padding: 0px;">
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; line-height: normal;">
<img alt="pi19404" class="avatar" data-cke-saved-src="https://avatars2.githubuserremoved.com/u/2353588?v=2&s=40" data-user="2353588" height="20" src="https://avatars2.githubuserremoved.com/u/2353588?v=2&s=40" style="border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: border-box; cursor: default; display: inline-block; line-height: 1; margin: 0px; overflow: hidden; padding: 0px; vertical-align: middle;" width="20" /> <span class="author-name" style="border: 0px; box-sizing: border-box; color: #444444; margin: 0px; padding: 0px;"><a data-cke-saved-href="https://github.com/pi19404" href="https://github.com/pi19404" rel="author" style="background: transparent; border: 0px; box-sizing: border-box; color: #444444; font-weight: bold; margin: 0px; padding: 0px; text-decoration: none;">pi19404</a></span> authored <time class="updated" datetime="2014-10-06T18:48:41Z" is="relative-time" style="box-sizing: border-box; color: darkorange;" title="Oct 7, 2014 12:18 AM GMT+05:30">18 minutes ago</time></div>
</div>
</div>
</div>
<div class="file-wrap" style="background-color: white; border-bottom-color: rgb(221, 221, 221); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-bottom-style: solid; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-right-color: rgb(221, 221, 221); border-right-style: solid; border-width: 0px 1px 1px; box-sizing: border-box; color: #111111; font-family: Helvetica, arial, freesans, clean, sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 13px; line-height: 18.200000762939453px; margin: 0px; padding: 0px;">
<table class="files cke_show_border" data-pjax="" style="background: rgb(248, 248, 248); border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 2px; border-top-right-radius: 2px; border: 1px dotted rgb(211, 211, 211); box-sizing: border-box; margin: 0px; padding: 0px; width: 788px;"><tbody data-deferred-removed-error="Failed to load latest commit information." data-removed="/pi19404/pyVision/file-list/master" style="border: 0px; box-sizing: border-box; margin: 0px; padding: 0px;">
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border: 1px dotted rgb(211, 211, 211); box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border: 1px dotted rgb(211, 211, 211); box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/LoadDataSets.py" href="https://github.com/pi19404/pyVision/blob/master/LoadDataSets.py" id="da74ed72258e84f30ca72614c0952409-e8031d5dc64db97df3f5c470cc8eb25cb3cd7908" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="LoadDataSets.py">LoadDataSets.py</a></span></div>
</td><td class="message" style="border: 1px dotted rgb(211, 211, 211); box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/0f4e0af1a1d519757ec0d5c312954322a4121475" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/0f4e0af1a1d519757ec0d5c312954322a4121475" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="commiting pyvision subdir">commiting pyvision subdir</a></span></div>
</td><td class="age" style="border: 1px dotted rgb(211, 211, 211); box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:28:05Z" is="time-ago" style="box-sizing: border-box;" title="Oct 6, 2014 11:58 PM GMT+05:30">38 minutes ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/LoadDataSets.pyc" href="https://github.com/pi19404/pyVision/blob/master/LoadDataSets.pyc" id="3642368a28ed868d305b40aa82faca7b-5ec6fff46666c017f73e45dc0c2ee52e44845ae5" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="LoadDataSets.pyc">LoadDataSets.pyc</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/0f4e0af1a1d519757ec0d5c312954322a4121475" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/0f4e0af1a1d519757ec0d5c312954322a4121475" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="commiting pyvision subdir">commiting pyvision subdir</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:28:05Z" is="time-ago" style="box-sizing: border-box;" title="Oct 6, 2014 11:58 PM GMT+05:30">38 minutes ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/LogisticRegression.py" href="https://github.com/pi19404/pyVision/blob/master/LogisticRegression.py" id="41497e30604685897b315fc51be17e35-e7ec0fb8b12c0f37e87526c8baa4fc10c7e22f3d" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="LogisticRegression.py">LogisticRegression.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/fa1ff4b319fe8bc845063c0b300366d1f9807696" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/fa1ff4b319fe8bc845063c0b300366d1f9807696" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="MLP developement">MLP developement</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-04T05:45:36Z" is="time-ago" style="box-sizing: border-box;" title="Oct 4, 2014 11:15 AM GMT+05:30">3 days ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/MLP.pyvision1" href="https://github.com/pi19404/pyVision/blob/master/MLP.pyvision1" id="c2dd515f2c75dd3c8f67116dcf50989b-a9c2ec3c3864a7afa352579e79f1d3de2e3b5bf6" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="MLP.pyvision1">MLP.pyvision1</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="parent commit1">parent commit1</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:48:41Z" is="time-ago" style="box-sizing: border-box;" title="Oct 7, 2014 12:18 AM GMT+05:30">18 minutes ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/MLPHiddenLayer.py" href="https://github.com/pi19404/pyVision/blob/master/MLPHiddenLayer.py" id="74e64c82dde3c9045f12bfffa88615a6-208c75331abaac3aaed4d06967877899e6da013f" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="MLPHiddenLayer.py">MLPHiddenLayer.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/0f4e0af1a1d519757ec0d5c312954322a4121475" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/0f4e0af1a1d519757ec0d5c312954322a4121475" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="commiting pyvision subdir">commiting pyvision subdir</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:28:05Z" is="time-ago" style="box-sizing: border-box;" title="Oct 6, 2014 11:58 PM GMT+05:30">38 minutes ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/Optimizer.py" href="https://github.com/pi19404/pyVision/blob/master/Optimizer.py" id="cdd37b9620507a80003f5051bc324e83-4ffa7fdddcfca608fb3b8f9f7ee1c11ce9047156" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="Optimizer.py">Optimizer.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/0f4e0af1a1d519757ec0d5c312954322a4121475" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/0f4e0af1a1d519757ec0d5c312954322a4121475" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="commiting pyvision subdir">commiting pyvision subdir</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:28:05Z" is="time-ago" style="box-sizing: border-box;" title="Oct 6, 2014 11:58 PM GMT+05:30">38 minutes ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/bac.py" href="https://github.com/pi19404/pyVision/blob/master/bac.py" id="68b2bf54ed13f2342de2eba7c05069ff-7586c6d5e3846d9a7cf62332fd7149f6a9f08584" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="bac.py">bac.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/0566b17814a8a54341bb5a73150d217e1ae50a62" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/0566b17814a8a54341bb5a73150d217e1ae50a62" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="Adding Logistic Regression for machine learning">Adding Logistic Regression for machine learning</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-09-21T14:35:39Z" is="time-ago" style="box-sizing: border-box;" title="Sep 21, 2014 8:05 PM GMT+05:30">15 days ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/calclex.py" href="https://github.com/pi19404/pyVision/blob/master/calclex.py" id="51299fe029d56ef376cf499a7512f45e-cf354174f9fdcb5068e9149b9f912d078b58006a" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="calclex.py">calclex.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="parent commit1">parent commit1</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:48:41Z" is="time-ago" style="box-sizing: border-box;" title="Oct 7, 2014 12:18 AM GMT+05:30">18 minutes ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/m1.py" href="https://github.com/pi19404/pyVision/blob/master/m1.py" id="294241b2b480daf44ef0bc2d4e2c3092-33d6e7878151e6ae84347be900ab7fcfaf13295d" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="m1.py">m1.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="parent commit1">parent commit1</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:48:41Z" is="time-ago" style="box-sizing: border-box;" title="Oct 7, 2014 12:18 AM GMT+05:30">18 minutes ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/parsetab.py" href="https://github.com/pi19404/pyVision/blob/master/parsetab.py" id="f75b1bd9c4ae937a4cdb7048059a2147-91ac59631c588e1fd6be6cc316f813ce8af6324e" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="parsetab.py">parsetab.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="parent commit1">parent commit1</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:48:41Z" is="time-ago" style="box-sizing: border-box;" title="Oct 7, 2014 12:18 AM GMT+05:30">18 minutes ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/pyvision.py" href="https://github.com/pi19404/pyVision/blob/master/pyvision.py" id="996647c0e37c39a26bcfc98056a49bfa-d2506182cad2ffea8e027b8f00b7165e26ae388c" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="pyvision.py">pyvision.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="parent commit1">parent commit1</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:48:41Z" is="time-ago" style="box-sizing: border-box;" title="Oct 7, 2014 12:18 AM GMT+05:30">18 minutes ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/pyvision_common.py" href="https://github.com/pi19404/pyVision/blob/master/pyvision_common.py" id="ef3adfce8912fd5809ac9190acac42fa-a2fac149791594f25d4cc6c43775c642b90c9bc1" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="pyvision_common.py">pyvision_common.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/971551264ca1ffdf0bf63faf87a8a4fd7c1340c1" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/971551264ca1ffdf0bf63faf87a8a4fd7c1340c1" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="resolving bugs in LogisticRegression class">resolving bugs in LogisticRegression class</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-01T14:35:08Z" is="time-ago" style="box-sizing: border-box;" title="Oct 1, 2014 8:05 PM GMT+05:30">5 days ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/sgd.py" href="https://github.com/pi19404/pyVision/blob/master/sgd.py" id="bcb6f08d4c0c618911416b2aa11bd672-7fce17ba1084be4e65281ab7084d14bf175acd34" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="sgd.py">sgd.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="parent commit1">parent commit1</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:48:41Z" is="time-ago" style="box-sizing: border-box;" title="Oct 7, 2014 12:18 AM GMT+05:30">18 minutes ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/t3.py" href="https://github.com/pi19404/pyVision/blob/master/t3.py" id="fc2a91d054d58229a032b9b532eccce8-6c679867e404f195ac6855f9bf2aa70f6ca2b731" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="t3.py">t3.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="parent commit1">parent commit1</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:48:41Z" is="time-ago" style="box-sizing: border-box;" title="Oct 7, 2014 12:18 AM GMT+05:30">18 minutes ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/test_parser.py" href="https://github.com/pi19404/pyVision/blob/master/test_parser.py" id="968d394b7a4941a1d06cf2232f8b0f68-53f37b561a20bcc87bfb910b9dc5021d37bab1fc" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="test_parser.py">test_parser.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="parent commit1">parent commit1</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:48:41Z" is="time-ago" style="box-sizing: border-box;" title="Oct 7, 2014 12:18 AM GMT+05:30">18 minutes ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/test_parser2.py" href="https://github.com/pi19404/pyVision/blob/master/test_parser2.py" id="215380b49b7bf0e790dde33df5f0fe8c-0af2ff2f1c18e43169e20351fbc31540bb3f87b3" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="test_parser2.py">test_parser2.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="parent commit1">parent commit1</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:48:41Z" is="time-ago" style="box-sizing: border-box;" title="Oct 7, 2014 12:18 AM GMT+05:30">18 minutes ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/test_plot.py" href="https://github.com/pi19404/pyVision/blob/master/test_plot.py" id="663a55d7fa6628188d85c10d3e83eaeb-17d40b3516e47e28fc027303bc4c3145c6341ff9" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="test_plot.py">test_plot.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="parent commit1">parent commit1</a></span></div>
</td></tr>
</tbody></table>
</div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
now there can be two cases of updating the project in the parent or separated repository </div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
To avoid any issues,we remove the subdirectory and create is again the parent directory</div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); color: black; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;"><strong style="border: 0px; margin: 0px; padding: 0px;">git rm ImgML/PyVision
git subtree add --prefix=ImgML/PyVision pyVision master</strong>
commit 6c22aa8f1c11b201ff03f057963d5b4063c85457
Merge: 7676342 6ce46a5
Author: pi19404 <pi19404 gmail.com="">
Date: Tue Oct 7 01:58:43 2014 +0530
Add 'ImgML/PyVision/' from commit '6ce46a56b2052fc549f0db3e6e52f56083fb0e64'
git-subtree-dir: ImgML/PyVision
git-subtree-mainline: 7676342aa84a7b4d8bfffc655d6f0ed9af1a7eda
git-subtree-split: 6ce46a56b2052fc549f0db3e6e52f56083fb0e64
Changes in parent Directory</pi19404></pre>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
The above git log comments are essential when pulling commits from subdiretory remote repository</div>
<h2 style="font-family: 'Segoe UI', Arial, sans-serif; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
Changes in Parent Directory</h2>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<span style="border: 0px; margin: 0px; padding: 0px;">Let us make some changes in the parent repository,remove the files test_parser.py,test_parser3.py,test_plot.pyt,t3.py,sgd.py,parsetab.py,m1.py,calclex.py,bac.py,LoadDatasets.pyb</span></div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); color: black; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;"><strong style="border: 0px; margin: 0px; padding: 0px;"> git commit -m "removing unwanted files" -a</strong>
[master 4156a4d] removing unwanted files
<strong style="border: 0px; margin: 0px; padding: 0px;">git push origin master</strong></pre>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
will commit if any changes to master branch,but the subdirectory branch remains unaffected.</div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
To push changes to subdirectory branch we execute</div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); color: black; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;"><strong style="border: 0px; margin: 0px; padding: 0px;">git subtree push --prefix=ImgML/PyVision pyVision master</strong></pre>
<table class="files cke_show_border" data-pjax="" style="background: rgb(248, 248, 248); border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 2px; border-top-right-radius: 2px; border: 1px dotted rgb(211, 211, 211); box-sizing: border-box; color: #111111; font-family: Helvetica, arial, freesans, clean, sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 13px; line-height: 18.200000762939453px; margin: 0px; padding: 0px; width: 788px;"><tbody data-deferred-removed-error="Failed to load latest commit information." data-removed="/pi19404/pyVision/file-list/master" style="border: 0px; box-sizing: border-box; margin: 0px; padding: 0px;">
<tr style="border: 0px; box-sizing: border-box; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; line-height: normal; margin: 0px; padding: 0px;"><td class="icon" style="border: 1px dotted rgb(211, 211, 211); box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border: 1px dotted rgb(211, 211, 211); box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/LoadDataSets.py" href="https://github.com/pi19404/pyVision/blob/master/LoadDataSets.py" id="da74ed72258e84f30ca72614c0952409-e8031d5dc64db97df3f5c470cc8eb25cb3cd7908" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="LoadDataSets.py">LoadDataSets.py</a></span></div>
</td><td class="message" style="border: 1px dotted rgb(211, 211, 211); box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/0f4e0af1a1d519757ec0d5c312954322a4121475" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/0f4e0af1a1d519757ec0d5c312954322a4121475" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="commiting pyvision subdir">commiting pyvision subdir</a></span></div>
</td><td class="age" style="border: 1px dotted rgb(211, 211, 211); box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:28:05Z" is="time-ago" style="box-sizing: border-box;" title="Oct 6, 2014 11:58 PM GMT+05:30">an hour ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; line-height: normal; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/LogisticRegression.py" href="https://github.com/pi19404/pyVision/blob/master/LogisticRegression.py" id="41497e30604685897b315fc51be17e35-e7ec0fb8b12c0f37e87526c8baa4fc10c7e22f3d" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="LogisticRegression.py">LogisticRegression.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/fa1ff4b319fe8bc845063c0b300366d1f9807696" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/fa1ff4b319fe8bc845063c0b300366d1f9807696" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="MLP developement">MLP developement</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-04T05:45:36Z" is="time-ago" style="box-sizing: border-box;" title="Oct 4, 2014 11:15 AM GMT+05:30">3 days ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; line-height: normal; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/MLP.pyvision1" href="https://github.com/pi19404/pyVision/blob/master/MLP.pyvision1" id="c2dd515f2c75dd3c8f67116dcf50989b-a9c2ec3c3864a7afa352579e79f1d3de2e3b5bf6" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="MLP.pyvision1">MLP.pyvision1</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="parent commit1">parent commit1</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:48:41Z" is="time-ago" style="box-sizing: border-box;" title="Oct 7, 2014 12:18 AM GMT+05:30">33 minutes ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; line-height: normal; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/MLPHiddenLayer.py" href="https://github.com/pi19404/pyVision/blob/master/MLPHiddenLayer.py" id="74e64c82dde3c9045f12bfffa88615a6-208c75331abaac3aaed4d06967877899e6da013f" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="MLPHiddenLayer.py">MLPHiddenLayer.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/0f4e0af1a1d519757ec0d5c312954322a4121475" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/0f4e0af1a1d519757ec0d5c312954322a4121475" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="commiting pyvision subdir">commiting pyvision subdir</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:28:05Z" is="time-ago" style="box-sizing: border-box;" title="Oct 6, 2014 11:58 PM GMT+05:30">an hour ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; line-height: normal; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/Optimizer.py" href="https://github.com/pi19404/pyVision/blob/master/Optimizer.py" id="cdd37b9620507a80003f5051bc324e83-4ffa7fdddcfca608fb3b8f9f7ee1c11ce9047156" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="Optimizer.py">Optimizer.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/0f4e0af1a1d519757ec0d5c312954322a4121475" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/0f4e0af1a1d519757ec0d5c312954322a4121475" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="commiting pyvision subdir">commiting pyvision subdir</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:28:05Z" is="time-ago" style="box-sizing: border-box;" title="Oct 6, 2014 11:58 PM GMT+05:30">an hour ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; line-height: normal; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/pyvision.py" href="https://github.com/pi19404/pyVision/blob/master/pyvision.py" id="996647c0e37c39a26bcfc98056a49bfa-d2506182cad2ffea8e027b8f00b7165e26ae388c" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="pyvision.py">pyvision.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/ae84838a2975d3a51efbab7f7c0fbcb94783c056" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="parent commit1">parent commit1</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-06T18:48:41Z" is="time-ago" style="box-sizing: border-box;" title="Oct 7, 2014 12:18 AM GMT+05:30">33 minutes ago</time></span></div>
</td></tr>
<tr style="border: 0px; box-sizing: border-box; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; line-height: normal; margin: 0px; padding: 0px;"><td class="icon" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #777777; line-height: 20px; margin: 0px; padding: 6px 2px 6px 10px; width: 17px;"><div style="color: #111111; line-height: normal;">
<br /></div>
</td><td class="removed" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; line-height: 20px; margin: 0px; max-width: 180px; padding: 6px 3px;"><div style="line-height: normal;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="js-directory-link" data-cke-saved-href="https://github.com/pi19404/pyVision/blob/master/pyvision_common.py" href="https://github.com/pi19404/pyVision/blob/master/pyvision_common.py" id="ef3adfce8912fd5809ac9190acac42fa-a2fac149791594f25d4cc6c43775c642b90c9bc1" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;" title="pyvision_common.py">pyvision_common.py</a></span></div>
</td><td class="message" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 442px; overflow: hidden; padding: 6px 3px 6px 10px;"><div style="color: #111111; line-height: normal;">
<span class="css-truncate css-truncate-target " style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;"><a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/971551264ca1ffdf0bf63faf87a8a4fd7c1340c1" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/971551264ca1ffdf0bf63faf87a8a4fd7c1340c1" style="background: transparent; border: 0px; box-sizing: border-box; color: #888888; margin: 0px; padding: 0px; text-decoration: none;" title="resolving bugs in LogisticRegression class">resolving bugs in LogisticRegression class</a></span></div>
</td><td class="age" style="border-color: rgb(238, 238, 238) rgb(211, 211, 211) rgb(211, 211, 211); border-style: solid dotted dotted; border-width: 1px; box-sizing: border-box; color: #888888; line-height: 20px; margin: 0px; max-width: 140px; padding: 6px 10px 6px 3px; text-align: right; white-space: nowrap;"><div style="border: 0px; color: #111111; line-height: normal; margin: 0px; padding: 0px;">
<span class="css-truncate css-truncate-target" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top;"><time datetime="2014-10-01T14:35:08Z" is="time-ago" style="box-sizing: border-box;" title="Oct 1, 2014 8:05 PM GMT+05:30">5 days ago</time></span></div>
</td></tr>
</tbody></table>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<h2 style="font-family: 'Segoe UI', Arial, sans-serif; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
Changes in the subdirectory</h2>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
Let us make some changes in the sub directory and we want the changes to reflect in the parent directory</div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
we push multiple commits onto the remote subdirectory and merge them in parent directory and maintaining all the changes in remote as a single commit using the squash directive</div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<ol class="commit-group table-list table-list-bordered" style="background-color: white; border-bottom-color: rgb(229, 229, 229); border-bottom-style: solid; border-width: 0px 0px 1px; box-sizing: border-box; color: #999999; display: table; font-family: Helvetica, arial, freesans, clean, sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 13px; line-height: 18.200000762939453px; list-style-type: none; margin: 10px 0px; padding: 0px 0px 0px 40px; table-layout: fixed; width: 881px;">
<li class="commit commits-list-item table-list-item js-navigation-item js-details-container js-socket-channel js-updatable-removed" data-channel="pi19404/pyVision:commit:6ce46a56b2052fc549f0db3e6e52f56083fb0e64" data-removed="/pi19404/pyVision/commit/6ce46a56b2052fc549f0db3e6e52f56083fb0e64/show_partial?partial=commits%2Fcommits_list_item" style="border: 0px; box-sizing: border-box; color: #111111; display: table-row; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; line-height: normal; list-style: none; margin: 0px; padding: 0px;"><div class="table-list-cell commit-avatar-cell" style="border-left-color: rgb(229, 229, 229); border-left-style: solid; border-top-color: rgb(238, 238, 238); border-top-style: solid; border-width: 1px 0px 0px 1px; box-sizing: border-box; display: table-cell; font-size: 12px; margin: 0px; padding: 0px; vertical-align: top; width: 47px;">
<div class="avatar-parent-child" style="border: 0px; box-sizing: border-box; margin: 0px; padding: 0px;">
<div style="font-size: 14px;">
<a data-cke-saved-href="https://github.com/pi19404" data-skip-pjax="true" href="https://github.com/pi19404" rel="author" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;"><img alt="pi19404" class="avatar" data-cke-saved-src="https://avatars1.githubuserremoved.com/u/2353588?v=2&s=72" data-user="2353588" height="36" src="https://avatars1.githubuserremoved.com/u/2353588?v=2&s=72" style="border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: border-box; cursor: default; display: inline-block; line-height: 1; margin: 0px; overflow: hidden; padding: 0px; vertical-align: middle;" width="36" /></a></div>
</div>
</div>
<div class="commit-body table-list-cell" style="border-top-color: rgb(238, 238, 238); border-top-style: solid; border-width: 1px 0px 0px; box-sizing: border-box; display: table-cell; font-size: 12px; margin: 0px; padding: 8px 10px; vertical-align: top;">
<div class="commit-title " style="border: 0px; box-sizing: border-box; color: #333333; font-size: 15px; font-weight: bold; margin: 0px; padding: 0px;">
<div style="color: #111111; font-size: 14px;">
<a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/6ce46a56b2052fc549f0db3e6e52f56083fb0e64" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/6ce46a56b2052fc549f0db3e6e52f56083fb0e64" style="background: transparent; border: 0px; box-sizing: border-box; color: #4e575b; margin: 0px; padding: 0px; text-decoration: none;" title="subdir commit 2">subdir commit 2</a></div>
</div>
<div class="commit-meta" style="border: 0px; box-sizing: border-box; color: #999999; margin: 0px; padding: 0px;">
<div style="color: #111111; font-size: 14px;">
<a aria-label="View all commits by pi19404" class="commit-author tooltipped tooltipped-s" data-cke-saved-href="https://github.com/pi19404/pyVision/commits/master?author=pi19404" href="https://github.com/pi19404/pyVision/commits/master?author=pi19404" rel="author" style="background: transparent; border: 0px; box-sizing: border-box; color: #777777; margin: 0px; padding: 0px; text-decoration: none;">pi19404</a> authored <time datetime="2014-10-06T19:42:27Z" is="relative-time" style="box-sizing: border-box;" title="Oct 7, 2014 1:12 AM GMT+05:30">30 seconds ago</time></div>
</div>
</div>
<div class="commit-links-cell table-list-cell" style="border-right-color: rgb(229, 229, 229); border-right-style: solid; border-top-color: rgb(238, 238, 238); border-top-style: solid; border-width: 1px 1px 0px 0px; box-sizing: border-box; display: table-cell; font-size: 12px; margin: 0px; padding: 8px 10px; text-align: right; vertical-align: top; width: 230px;">
<div class="commit-links-group button-group" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; padding: 0px 1em 0px 0px; vertical-align: middle; white-space: nowrap;">
<div style="font-size: 14px;">
<a class="sha button-outline" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/6ce46a56b2052fc549f0db3e6e52f56083fb0e64" href="https://github.com/pi19404/pyVision/commit/6ce46a56b2052fc549f0db3e6e52f56083fb0e64" style="-webkit-appearance: none; -webkit-user-select: none; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-repeat: initial; background-size: initial; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(229, 229, 229); box-sizing: border-box; color: #4183c4; display: inline-block; float: left; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-weight: bold; margin: 0px; padding: 5px 8px; text-decoration: none; vertical-align: middle;">6ce46a5</a></div>
</div>
</div>
</li>
<li class="commit commits-list-item table-list-item js-navigation-item js-details-container js-socket-channel js-updatable-removed navigation-focus" data-channel="pi19404/pyVision:commit:e3c5a16a49951b1619649ad6be022b2f3deeec0f" data-removed="/pi19404/pyVision/commit/e3c5a16a49951b1619649ad6be022b2f3deeec0f/show_partial?partial=commits%2Fcommits_list_item" style="background: rgb(247, 251, 252); border: 0px; box-sizing: border-box; color: #111111; display: table-row; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; line-height: normal; list-style: none; margin: 0px; padding: 0px;"><div class="table-list-cell commit-avatar-cell" style="border-left-color: rgb(229, 229, 229); border-left-style: solid; border-top-color: rgb(238, 238, 238); border-top-style: solid; border-width: 1px 0px 0px 1px; box-sizing: border-box; display: table-cell; font-size: 12px; margin: 0px; padding: 0px; vertical-align: top; width: 47px;">
<div class="avatar-parent-child" style="border: 0px; box-sizing: border-box; margin: 0px; padding: 0px;">
<div style="font-size: 14px;">
<a data-cke-saved-href="https://github.com/pi19404" data-skip-pjax="true" href="https://github.com/pi19404" rel="author" style="background: transparent; border: 0px; box-sizing: border-box; color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;"><img alt="pi19404" class="avatar" data-cke-saved-src="https://avatars1.githubuserremoved.com/u/2353588?v=2&s=72" data-user="2353588" height="36" src="https://avatars1.githubuserremoved.com/u/2353588?v=2&s=72" style="border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: border-box; cursor: default; display: inline-block; line-height: 1; margin: 0px; overflow: hidden; padding: 0px; vertical-align: middle;" width="36" /></a></div>
</div>
</div>
<div class="commit-body table-list-cell" style="border-top-color: rgb(238, 238, 238); border-top-style: solid; border-width: 1px 0px 0px; box-sizing: border-box; display: table-cell; font-size: 12px; margin: 0px; padding: 8px 10px; vertical-align: top;">
<div class="commit-title " style="border: 0px; box-sizing: border-box; color: #333333; font-size: 15px; font-weight: bold; margin: 0px; padding: 0px;">
<div style="color: #111111; font-size: 14px;">
<a class="message" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/e3c5a16a49951b1619649ad6be022b2f3deeec0f" data-pjax="true" href="https://github.com/pi19404/pyVision/commit/e3c5a16a49951b1619649ad6be022b2f3deeec0f" style="background: transparent; border: 0px; box-sizing: border-box; color: #4e575b; margin: 0px; padding: 0px; text-decoration: none;" title="subdir commit 1">subdir commit 1</a></div>
</div>
<div class="commit-meta" style="border: 0px; box-sizing: border-box; color: #999999; margin: 0px; padding: 0px;">
<div style="color: #111111; font-size: 14px;">
<a aria-label="View all commits by pi19404" class="commit-author tooltipped tooltipped-s" data-cke-saved-href="https://github.com/pi19404/pyVision/commits/master?author=pi19404" href="https://github.com/pi19404/pyVision/commits/master?author=pi19404" rel="author" style="background: transparent; border: 0px; box-sizing: border-box; color: #777777; margin: 0px; padding: 0px; text-decoration: none;">pi19404</a> authored <time datetime="2014-10-06T19:42:01Z" is="relative-time" style="box-sizing: border-box;" title="Oct 7, 2014 1:12 AM GMT+05:30">a minute ago</time></div>
</div>
</div>
<div class="commit-links-cell table-list-cell" style="border-right-color: rgb(229, 229, 229); border-right-style: solid; border-top-color: rgb(238, 238, 238); border-top-style: solid; border-width: 1px 1px 0px 0px; box-sizing: border-box; display: table-cell; font-size: 12px; margin: 0px; padding: 8px 10px; text-align: right; vertical-align: top; width: 230px;">
<div class="commit-links-group button-group" style="border: 0px; box-sizing: border-box; display: inline-block; margin: 0px; padding: 0px 1em 0px 0px; vertical-align: middle; white-space: nowrap;">
<div style="font-size: 14px;">
<a class="sha button-outline" data-cke-saved-href="https://github.com/pi19404/pyVision/commit/e3c5a16a49951b1619649ad6be022b2f3deeec0f" href="https://github.com/pi19404/pyVision/commit/e3c5a16a49951b1619649ad6be022b2f3deeec0f" style="-webkit-appearance: none; -webkit-user-select: none; background: rgb(255, 255, 255); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(229, 229, 229); box-sizing: border-box; color: #4183c4; display: inline-block; float: left; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-weight: bold; margin: 0px; padding: 5px 8px; text-decoration: none; vertical-align: middle;">e3c5a16</a></div>
</div>
</div>
</li>
<li class="commit commits-list-item table-list-item js-navigation-item js-details-container js-socket-channel js-updatable-removed" data-channel="pi19404/pyVision:commit:e4e4531fe9d84d8d1b842ab0fe60f8498afd83cc" data-removed="/pi19404/pyVision/commit/e4e4531fe9d84d8d1b842ab0fe60f8498afd83cc/show_partial?partial=commits%2Fcommits_list_item" style="border: 0px; box-sizing: border-box; color: #111111; display: table-row; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; line-height: normal; list-style: none; margin: 0px; padding: 0px;"><div class="table-list-cell commit-avatar-cell" style="border-left-color: rgb(229, 229, 229); border-left-style: solid; border-top-color: rgb(238, 238, 238); border-top-style: solid; border-width: 1px 0px 0px 1px; box-sizing: border-box; display: table-cell; font-size: 12px; margin: 0px; padding: 0px; vertical-align: top; width: 47px;">
<div style="font-size: 14px;">
<br /></div>
</div>
</li>
</ol>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br /></div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
we pull the changes from the parent directory</div>
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); color: black; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;">git subtree pull --prefix=ImgML/PyVision pyVision master --squash</pre>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
<br />
<h2 style="color: #333333; font-size: 30px; font-weight: 200; margin: 0px; padding: 0px 0px 10px;">
<span style="border: 0px; color: #333333; margin: 0px; padding: 0px;">Installation</span></h2>
</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<span style="border: 0px; color: #111111; margin: 0px; padding: 0px;">you can find instructions on how to install git subtree from sources at link </span><a data-cke-saved-href="http://engineeredweb.com/blog/how-to-install-git-subtree/" href="http://engineeredweb.com/blog/how-to-install-git-subtree/" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">http://engineeredweb.com/blog/how-to-install-git-subtree/</a><span style="border: 0px; color: #111111; margin: 0px; padding: 0px;"> since git subtree changes were introduced in git version 1.7.11 it may not be available in ubuntu repositories by default.</span></div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
Else you can install latest version of git</div>
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); color: black; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px; tab-size: 4;">sudo add-apt-repository ppa:git-core/ppa </pre>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
use synaptic ,update the sources by clicking on reload and install the latest version of git</div>
<div style="border: 0px; color: black; font-size: medium; margin: 0px; padding: 0px;">
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
</div>
<div style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;">
git subtree sciript can be found at /usr/share/doc/git/contrib/subtree/git-subtree.sh<br />
<div style="border: 0px; margin: 0px; padding: 0px;">
<br /></div>
</div>
</div>
</div>
pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-22548139181858539022014-10-03T00:50:00.000+05:302014-10-03T00:57:13.978+05:30Logistic Classifier - Overfitting and Regularization <div dir="ltr" style="text-align: left;" trbidi="on">
<br />
In this article we will look at Logistic regression classifier and how regularization affects the performance of the classifier.<br />
<br />
Training a machine learning algorithms involves optimization techniques.However apart from providing good accuracy on training and validation data sets ,it is required the machine learning to have good generalization accuracy.The machine learning algorithms should perform well on unseen examples as well.The model is trained by optimizing its performance over some training dataset however its performance is determined on its ability to perform on unseen datasets.<br />
<br />
The term over fitting is often used when machine learning algorithm has high accuracy on training data set but poor generalization accuracy.<br />
<h2>
<strong>Problem of Overfitting</strong></h2>
Over-fitting generally occurs when a model is excessively complex.A model that has been overfit will generally have poor generalization capabilities , as it can perform errors due to minor fluctuations in data dues to noise and other parameters which were not modeled during the training process.<br />
<br />
Just because a model agrees with training data does not mean it will perform well on unseen examples and is not necessarily a good model.In case of overfitting the model just tries to learn pecularities of the training set and does not work well on unseen examples that differ from the training set.<br />
<br />
In general over-fitting can be associated with complexity.In multiclass logistic classifier for MNIST digit classification where are 7850 free parameters that are optimized.This is a large number of parameters.<br />
<h2>
<strong>Training,Validation and Testing Datasets</strong></h2>
Typically we can get some idea as to if over-fitting has been performed on not by periodically testing the model on unseen test data set.Thus during the training process we make use of 3 types of data sets.Training data set that is primarily used for learning.The validation data set which is a part of training data set but no used during the learning and test data set that contains a large variations of typically input data that represents all possible unseen examples.<br />
<br />
The validation data set is the unseen data set against when we can test the model to check for over-fitting and generalization performance.The learning algorithm has not seen the samples from the validation data set.Validation data sets is used to test the various choices of the model parameters .Thus validation data set which is again considered a part of training dataset is used to periodically evaluate the model parameters.Based on the performance of the model we decide if over-fitting has occurred,learning process has been saturated and possibly adaptively tune the model.<br />
<br />
The difference between validation data set and test data set is that validation data set is not as challenging as the test data set.It contains unseen examples but may not contain a large variation or all possible end cases or difficult examples.<br />
<br />
The test data is primarily used to check if the model truly performs as expected agains a large variation in data.That is why the test data set is supposed to contains samples with large variations in data and difficult and end cases ,which are not included in the training data .If we use test data directly for validation purpose we may bias the classifier to overfit or choose parameters according to the test data ,which is again undesirable for the sake of generality<br />
<h2>
<strong>Validation Curves</strong></h2>
If the we find that validation accuracy or training accuracy is increasing while the accuracy on test data is decreasing we can assume that this is due to over-fitting.Intuitively, over-fitting occurs when the model or the algorithm fits the data too well.<br />
<br />
In some causes we may observe that accuracy on the training data is reducing while that on the test data is constant .This also may imply over-fitting. Since model is trying to fit the training data better by updating the model ,however updating the model does not affect its performance on the test data set.<br />
<h2>
<strong>Avoid Overfitting</strong></h2>
In the article we look at logistic regression classifier and how to handle the cases of overfitting<br />
<h3>
<strong>Increasing size of dataset</strong></h3>
One of the ways to combat over-fitting is to increase the training data size.Let take the case of MNIST data set trained with 5000 and 50000 examples,using similar training process and parameters.<br />
Below are observed errors on the training,validation and testing dataset<br />
<img alt="" src="https://googledrive.com/host/0B-pfqaQBbAAtaEUwM1hsdlRZSnc/a1.png" style="height: 240px; width: 320px;" /><br />
at the 250-th iteration the errors are<br />
<b>training accuracy is 12.34 %<br />
testing accuracy is 12.0 %<br />
validation accuracy is 11.29 %</b><br />
<br />
we can observe that training and validation errors steadily decrease during the initial part of the learning process.However after 100-th iteration we can observe that rate at which training error improves is larger that that of validation errors.<br />
<br />
The validation error essentially remains constant.At 120-th iteration we see again some improvement in validation curves ,but still rate of error on training dataset is higher.After the 140-th iteration it is validation curves essentially represents a straight line indicating no learning though the training error keeps on reducing.This may be an indication of over-fitting.<br />
<br />
Now lets perform the same testing with the complete set of 50000 samples.Of cource the absolute error will be better when we include a larger training set as the classifier would learn to handle larger variations in data.But what is essential is to observe the rate of change of errors and not the absolute errors.<br />
<img alt="" src="https://googledrive.com/host/0B-pfqaQBbAAtaEUwM1hsdlRZSnc/a2.png" style="height: 240px; width: 320px;" /><br />
we can see at 250-iteration the errors are<br />
<b>training accuracy is 11.34 %<br />
testing accuracy is 10.0 %<br />
validation accuracy is 10.29 %</b><br />
<br />
This is almost the same as the earlier training process.This implies that training of data from 5000 samples dataset for 250 iterations gives a similar performance a using a larger data set.This may lead us to conclude that learning algorithm has learn efficiently from data.However what is essential to observe that there is no saturation of error curves.The error curves are dropping at a larger rate at 300 in the present example than the earlier one.Thus if we had let the training continue the error rates would have dropped even more before saturating.Especially we would have obtained lower error on test and validation data sets.<br />
<br />
Thus increasing the training sample size has avoided over-fitting at 300-th iteration of the training process and will lead to better generalization performance.<br />
<h3>
Early stopping</h3>
Another way to combat over-fitting is to perform early stopping.<br />
<br />
Early stopping rules provide guidance as to how many iterations can be run before the learner begins to over-fit. Early stopping rules have been employed in many different machine learning methods, with varying amounts of theoretical foundation<br />
<div>
<br />
Early stopping based on cross-validation combats over-fitting by monitoring the model’s performance on a validation set.The error on the validation set is used as a proxy for the generalization error in determining when over-fitting has begun.<br />
<span style="background-color: white; color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.399999618530273px;"><br /></span>
Many ad-hoc rules for deciding when over-fitting has truly begun are used in different implementation but few how them have any theoretical foundation.</div>
<div>
<br />
One of rules may be that if we see that the error on the training data is decreasing while error on the validation dataset remains constant or begins to decrease,this may indicate that we need to stop the training process or it might lead to over-fitting.<br />
<br />
One of the commonly used criteria for early stopping is rate of change fo validation error.If the validation error does not change significantly in successive iterations ,we reduces the number of iterations for which gradient based learning is performed.<br />
<br />
As mentioned earlier A validation set is a set of examples that we never use for gradient descent, but which is also not a part of the test set.The validation examples are considered to be representative of future test examples.If the model’s performance ceases to improve sufficiently on the validation set, or even degrades with further optimization, then the some heuristic's can be employed to cease further optimization.<br />
<span style="background-color: white;"><br /></span>In present article we specify a strategy based on a geometrically increasing amount of patience which are used in<span style="background-color: white; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;"><span style="font-size: 14px; letter-spacing: -0.14000000059604645px; line-height: 21px;"> </span><a href="http://deeplearning.net/tutorial/" style="font-size: 14px; letter-spacing: -0.14000000059604645px; line-height: 21px;">deeplearning.net tutorials</a><span style="font-size: 14px; letter-spacing: -0.14000000059604645px; line-height: 21px;"> </span></span>in stochastic gradient learning based frameworks.We will look at stochastic gradient descent algorithms in the future artciles .The gradient based learning algorithms executes the learning algorithms N times.<br />
<span style="background-color: white; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif; font-size: 14px; letter-spacing: -0.14000000059604645px; line-height: 21px;"><br /></span>
In mathematics, a geometric progression, also known as a geometric sequence, is a sequence of numbers where each term after the first is found by multiplying the previous one by a fixed, non-zero number called the common ratio.<br />
<br />
The heuristic used is the geometric progression of validation error.Let us consider the common ratio of 0.9.if best validation error be 0.5 and next one is less than 0.9*0.5=0.45 the we consider that signifiant reduction in error has occurred.<br />
<br />
if error has reduced significantly then we increase the number of iteration the algorithm is supposed to run by a geometric factor and if there is no significant increase in error we reduce the number of iteration to be run by a geometric factor.If the max number of iterations have been reached then we say that learning process has been completed and retain the parameters of the best learning iteration.<br />
<img alt="" src="https://googledrive.com/host/0B-pfqaQBbAAtaEUwM1hsdlRZSnc/a3.png" style="height: 240px; width: 320px;" /><br />
Using this criteria the for training samples with 5000 samples,the learning stops at 134-th iteration with<br />
<br />
<b>
training accuracy is 12.82 %<br />
testing accuracy is 11.4 %<br />
validation accuracy is 12.09 %</b><br />
<br />
we can see that at even 250-th iteration we had not obtained a significant improvement in the performance<br />
<br />
<b>training accuracy is 12.34 %<br />
testing accuracy is 12.0 %<br />
validation accuracy is 11.29 %</b><br />
<b><br /></b>
Thus early stopping helps prevent over fitting.<br />
<br />
The code for validation heuristics is as follows<br />
<pre class="brush: python"> if error3 < self.best_validation_loss:
self.best_validation_loss=error3;
if error3 < self.best_validation_loss *self.improvement_threshold:
self.patience = max(self.patience, self.iter * self.patience_increase)
self.best_validation_loss = error3
self.best_iter = self.iter
else:
self.patience = min(self.patience,self.iter+self.iter/self.patience_increase)
</pre>
error3 is the current validation error in the above code. self.improvement_threshold is error improvement factor typically takes value between 0.9-1 self.patience_increase is geometric iteration factor,typically a value greater than 2. The number of iterations is reduced by this factor every time validation heuristic is not met.<br />
<br />
<h3>
<strong>Regularization</strong></h3>
<span style="background-color: white; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;"><span style="font-size: 14px; letter-spacing: -0.14000000059604645px; line-height: 21px;">A way to combat over-fitting is through regularization. </span></span>Regularization techniques can be viewed as imposing certain prior distribution on the model parameters.Mathematically the regularization process implies performing constrained optimization.<br />
<br />
L2 regularization implies imposing Gaussian prior on weights while L1 prior implies imposing Laplacian prior on weights.<br />
<br />
There are several regularization techniques .However in this article we will look at <span class="math">$L_{p}$</span> regularization and its effect on Logistic classification process.<br />
<span class="math">$L_{p}$</span> regularization involve adding an extra term to the cost function, which penalizes certain parameter configurations<br />
If the Original loss function is defined as<br />
<div class="math">
$\begin{eqnarray*} L(\theta,\mathcal{D}) = - \sum_{i=1}^N log P(Y=y_i | X=x_i,\theta) \end{eqnarray*}$</div>
The regularized loss function is given by<br />
<div class="math">
$\begin{eqnarray*} E(\theta,\mathcal{D}) = L(\theta,\mathcal{D}) + \lambda R(\theta) \end{eqnarray*}$</div>
<div class="math">
<br /></div>
<div class="math">
In the general in the case of $(L_{p}$ regularization</div>
<div class="math">
<br /></div>
<div class="math">
$\begin{align} R'(\theta)= \lambda || \theta||_{p}^p = \lambda \left(\sum_{j=0}^{|\theta|}{|\theta_j|^p}\right) \end{align}$</div>
<div class="math">
<br /></div>
where <span class="math">$||\theta||_{p}^p$</span> is the <span class="math">$L_p$</span> norm of <span class="math">$\theta$</span> and <span class="math">$\lambda$</span> is a parameter which controls the relative importance of the regularization parameter.Generally L1 or L2 norms are used .</div>
Intuitively adding the regularization term will penalizes large values of parameters which decrease the amount of non-linearity that the network models.Adding a regularization term will have the effect of simplifying the models and improve the performance in presence of over fitting. Thus performing minimization of loss functions in presence of regularization term will provide us the simplest model that can fit the training data.<br />
<br />
In the earlier article <a href="http://www.codeproject.com/Articles/821347/MultiClass-Logistic-Classifier-in-Python">"MultiClass Logistic Regression in Python"</a> the optimum parameters of the classifier were determined by minimizing the cost function.We had computed the gradient of the cost function wrt to the parameters.<br />
<br />
due to addition of regularization term to the cost function,the gradient cost function will have additional terms corresponding to gradient of L2 norm.<br />
<br />
The first effect of the regularization term is on the cost function.The cost function will have a prior likelihood on account of the regularization term.<br />
<br />
<pre class="brush: python"> def negative_log_likelihood(self,params):
# args contains the training data
x,y=self.args;
self.update_params(params);
sigmoid_activation = pyvision.softmax(self.W,self.b,x);
index=[range(0,np.shape(sigmoid_activation)[0]),y];
p=sigmoid_activation[index]
l=-np.mean(np.log(p));
if self.Regularization==2:
l=l+0.5*self.eta*np.sum(self.W**2);
if self.Regularization==1:
l=l+self.eta*np.sum(np.abs(self.W));
return l;
</pre>
The next changes is in the gradient computation.<br />
<pre class="brush:python"> """ function to compute the gradient of parameters for a single data sample """
def compute_gradients(self,out,y,x):
out=(np.reshape(out,(np.shape(out)[0],1)));
out[y]=out[y]-1;
W=out*x.T;
if self.Regularization==2:
W=W+self.eta*self.W;
if self.Regularization==1:
W=W+self.eta*np.sign(W);
res=np.vstack((W.T,out.flatten()))
return res;
</pre>
<div class="math">
where (i) indicates the class for which the derivative is being computed.</div>
<br />
L2 regularization based optimization is simple since the additional cost function added is continous and differentiable. For.For L1 regularization we use the basic sub-gradient method to compute the derivatives.<br />
<br />
First we look at L2 regularization process.<br />
<br />
<h4>
<strong>L2 Regularization</strong></h4>
The regularization is affected by regularization constant.Often the process is to determine the constant empirically by running the training with various values<br />
.<br />
A large values of constant will lead to flattening of error curves very soon an generally model will exhibit a lower accuracy.However a small values will lead to large number of iternations being performed and may lead to over-fitting.<br />
<br />
These can be seen from below curves for L2 regularization<br />
regularization parameter=0.9 <br />
<img alt="" src="https://googledrive.com/host/0B-pfqaQBbAAtaEUwM1hsdlRZSnc/l2_0.99.png" style="height: 360px; width: 480px;" /><br />
regularization parameter=0.1<br />
<img alt="" src="https://googledrive.com/host/0B-pfqaQBbAAtaEUwM1hsdlRZSnc/l2_0.1.png" style="height: 360px; width: 480px;" /><br />
we can see that with parameter value of 0.9 learning saturates at around 18% error at 40 iterations while for the value 0,1 learning saturates at iteration 120 with error of 15%.Thus regularization process in generally prevents the learning algorithm to respond to outliers in data by controlling the weight parameters.<br />
<br />
Thus we can observe inherent trade off.Regularization prevents the model to respond to variation in data,which in turn leads to lower accuracy of the model in learning all possible variations of data accurately.This is the case of bias variance trade off.<br />
<h4>
<strong>BIAS VARIANCE TRADE OFF </strong></h4>
Bias represents how the model represent the training data and variance is how the model responds to variation in data.<br />
<br />
Variance is large is different training sets give rise to very different classifier.Variance is small if training set has minor effect on the classification decisions.Variance measures how inconsistent the decisions and essentially variation of prediction of learned classifier.<br />
<br />
Models with high variances are sensitive to noise,small changes in training data sets can lead to significantly different model parameters.<br />
<br />
Models with high bias produce simple models that do not tend to over fit but may under-fit the data failing to capture the variations in the data.Models with low bias are complex enabling them to represents the training data accurately .<br />
<br />
Models with high variance exhibit large fluctuations wrt to changes in the data,they represent the training data well,but often over-fit the data .Models with low variance are not sensitive to changes in data,they can provide good generalization performance in presence of noise.<br />
<br />
Ideally one wants to choose a model that captures regularities in the training data as well as generalize well to unseen data.This however is not possible.There often exists a bias variance trade-off and many machine learning algorithms try to control this trade-off to obtain a good performance.<br />
<br />
The learning error can typically be represented as sum of bias and variance.During the minimization process,reducing the bias will often lead to higher variance and vice versa. The trade-off often comes in the form of selecting a model having higher bias and lower variance or one with lower bias and higher variance.Complex models will have low bias and high variance and simple models will have high bias and low variance.Ideally we would like the model to have low bias and low variance.<br />
<br />
The regularization parameter gives us control over bias-variance trade-off. Large value of regularization parameter leads reduces variance .Since regularization provides robustness in case of outliers in data.Low values of the parameter will lead regularization having no effect on learning.<br />
Thus regularization gives us a choice of reducing variance .The base learning algorithm is responsible for providing high bias.The a classifier with regularization can provide a good and robust model.<br />
<br />
<strong>L1 and L2 regularization </strong><br />
We can observe that model attains lower error rates using L1 regularization as opposed to L2 regularization at same number of iteration using identical regularization constant.constant. However the error rates remain higher that case with no regularization though learning algorithm converges faster.<br />
<br />
<strong>L2 regularization L1 regularization</strong><br />
<img alt="" src="https://googledrive.com/host/0B-pfqaQBbAAtaEUwM1hsdlRZSnc/l2_0.99.png" style="height: 240px; width: 320px;" /><img alt="" src="https://googledrive.com/host/0B-pfqaQBbAAtaEUwM1hsdlRZSnc/l1_0.99.png" style="height: 240px; width: 320px;" /><br />
<br />
In conclusion we can see various methods of combating overfitting and how it affects the performance of classifiers and how regularization gives us a tool to control the variance of the model.<br />
<h3>
CODE</h3>
The code for logistic regression classifier with regularization can be found at github repository<br />
<a href="https://github.com/pi19404/OpenVision/tree/master/ImgML/PyVision">https://github.com/pi19404/OpenVision/tree/master/ImgML/PyVision</a><br />
The files <strong>LogsiticRegression.py</strong> impements the LogisticRegression classifier with regression.<br />
<strong>Optimizer.py</strong> implments the minibatch stochastic gradient algorithm<br />
The entire pyVision directory is reuired for running the code.Running the LogisitcRegression.py files will execute the training process.<br />
It can be downloaded from<br />
<ul class="download">
<li><a href="http://www.codeproject.com/KB/Articles/824680/PyVision.tar">Download PyVision.tar - 30 KB</a></li>
<li><a href="https://github.com/pi19404/OpenVision/releases/download/v0.0.3/PyVision.tar">Alternate version</a></li>
</ul>
</div>
pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-72020815719207893522014-09-21T21:13:00.000+05:302014-10-01T20:32:31.341+05:30Multiclass Logistic Classifier In Python<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<h2>
Introduction</h2>
In this article we will look at basics of MultiClass Logistic Regression Classifier and its implementation in python<br />
<h2>
Background</h2>
<ul>
<li>Logistic regression is a discriminative probabilistic statistical classification model that can be used to predict the probability of occurrence of a event</li>
<li>It is supervised learning algorithm that can be applied to binary or multinomial classification problems where the classes are exhaustive and mutually exclusive.</li>
<li>Inputs to classification algorithm are real valued vectors of fixed dimensionality and outputs are the probability that input vector belongs to the specified class.</li>
<li>Logistic Regression is a type of regression that predicts the probability of occurrence of an event by fitting data to a logistic function .</li>
<li>Logistic Regression can also be considered as a linear model for classification</li>
<li>Logistic function is defined as</li>
</ul>
<img alt="" src="http://www.codeproject.com/KB/Articles/810988/ss1.png" style="color: black; font-family: Helvetica, Arial, sans-serif;" /><br />
The domain of logistic function lies between [0,1] for any value of input z.<br />
<img alt="" src="http://www.codeproject.com/KB/Articles/810988/ss2.png" style="color: black; font-family: Helvetica, Arial, sans-serif;" /><br />
Thus it can be used to characterize a cumulative distribution function.<br />
The function to apply logistic function to any real valued input vector "X" is defined in python as<br />
<br />
<pre class="python"> """ function applies logistic function to a real valued input vector x"""
def sigmoid(X):
'''Compute the sigmoid function '''
den = 1.0 + e ** (-1.0 * X)
d = 1.0 / den
return d</pre>
<ul>
<li>The Logistic Regression Classifier is parametrized by a weight matrix and a bias vector <span class="math">$\mathcal{W},\mathcal{b}$</span></li>
<li>Classification is done by projecting data points onto a set of hyper-planes, the distance to which is used to determine a class membership probability.</li>
<li>Mathematically this can be expressed as
<div class="math">
\begin{eqnarray*} P(Y=i|x, W,b) =\frac {e^{W_i x + b_i}}{\sum_j e^{W_j x + b_j}} \\ \end{eqnarray*}</div>
</li>
<li>Corresponding to each class <span class="math">$y_i$</span> logistic classifier is characterized by a set of parameters <span class="math">$W_i,b_i$</span>.</li>
</ul>
The above function is also called as softmax function.The logistic function applies to binary classification problem while the softmax function applies to multi-class classification problems.<br />
<br />
<pre class="python"> """ softmax function for multi class logistic regression """
def softmax(W,b,x):
vec=numpy.dot(x,W.T);
vec=numpy.add(vec,b);
vec1=numpy.exp(vec);
res=vec1.T/numpy.sum(vec1,axis=1);
return res.T;</pre>
The parameters <span class="math">$(W,b)$</span> are the weight vector and bias vector respectively.Let N be the dimension of input vector and M be the number of classes<br />
The dimension of W is (MXN) while that of B is (Mx1).The output of the softmax function if a vector of dimension (Mx1).<br />
<ul style="color: black; font-family: Helvetica, Arial, sans-serif;">
<li>These parameters are used to compute the class probability.</li>
<li>Given a unknown vector (x),The prediction is performed as
<div class="math">
\begin{eqnarray*} y_{pred} = argmax_i P(Y=i|x,W,b) \\ y_{pred} = argmax_i \frac {e^{W_i x + b_i}}{\sum_j e^{W_j x + b_j}} \end{eqnarray*}</div>
The code for the prediction function in python is as follows</li>
</ul>
<pre class="python"> """ function predicts the probability of input vector x"""
""" the output y is MX1 vector (M is no of classes) """
def predict(self,x):
y=softmax(self.W,self.b,x);
return y;</pre>
The code for classification function in python is as follows<br />
<br />
<pre class="python"> ''' function returns the lables corresponding to the input y '''
def lable(self,y):
return self.labels[y];
''' function classifies the input vector x into one of output lables '''
''' input is NXD vector then output is NX1 vector '''
def classify(self,x):
result=self.predict(x);
indices=result.argmax(axis=1);
#converting indices to lables
lablels=map(self.lable, indices);
return lablels;</pre>
The validation function accepts validation data and predicts the accuracy of model on the data set<br />
<pre class="python"> '''validation function to test the accuracy of model '''
def validate(self,x,y):
#classify the input vector x
result=self.classify(x);
y_test=y
#computer the prediction score
accuracy=met.accuracy_score(y_test,result)
#compute error in prediction
accuracy=1.0-accuracy;
print "Validation error " + `accuracy`
return accuracy;</pre>
<ul>
<li>Given a set of labelled training data <span class="math">${X_i,Y_i}$</span> where <span class="math">$i \in {1,\ldots,N}$</span> we need to estimate these parameters.</li>
</ul>
The essential components of Machine learning framework are<br />
<ul>
<li>Model ( Logistic Regression) - parameterized family of functions </li>
<li>Loss function - quantitative measurement of performance </li>
<li>Learning algorithm - Training criteria </li>
<li>Optimization algorithm - optimization algorithms</li>
</ul>
<h3>
Learning Algorithm</h3>
<ul>
<li>In general any machine learning algorithm consists of a model,loss function,learning algorithm and optimizer.</li>
<li>The learning algorithm estimates the parameters of model .This is done using optimization technique by maximizing some objective function.The objective function in case of machine learning algorithms is called as a loss function.</li>
<li>The optimization techniques work by defining a objective function and then find the parameters of the model that maximizes/minimizes the objective function.</li>
</ul>
<h3>
Loss Function</h3>
<ul>
<li>Ideally we would like to compute the parameters so that the (0-1) loss is minimized
<div class="math">
\begin{eqnarray*} \ell_{0,1} = \sum_{i=0}^{|\mathcal{D}|} I_{f(x^{(i)}) \neq y^{(i)}} \\ f(x)= argmax_k P(Y=y_k |x,\theta) \end{eqnarray*}
</div>
</li>
<li><span class="math">$P(Y=y_k |x,\theta)$</span> is modeled using logistic function.</li>
<li>The (0-1) loss function is not differentiable ,hence optimizing it for large modes is computationally infeasible.</li>
<li>In the present application negative log-likelihood is used as the loss function</li>
<li>Optimal parameters are learned by minimizing the loss function.</li>
</ul>
<h3>
Estimation technique/Learning algorithm</h3>
<ul>
<li>Estimation technique called Maximum Likelihood estimation is used to perform this operation.</li>
<li>The method estimate's the parameters so that likelihood of training data <span class="math">$\mathcal{D}$</span> is maximized under the model parameters</li>
<li>It is assumed that the data samples are independent ,so the probability of the set is the product of probabilities of individual examples.</li>
</ul>
<div class="math" style="color: black; font-family: Helvetica, Arial, sans-serif;">
\begin{eqnarray*} L(\theta={W,b},\mathcal{D}) =argmax \prod_{i=1}^N P(Y=y_i | X=x_i,W,b) \\ L(\theta,\mathcal{D}) = argmax \sum_{i=1}^N log P(Y=y_i | X=x_i,W,b) \\ L(\theta,\mathcal{D}) = - argmin \sum_{i=1}^N log P(Y=y_i | X=x_i,W,b) \\ \end{eqnarray*}</div>
<ul>
<li>It should be noted that Likelihood of correct class is not same as number of right predictions.</li>
<li>Log Likelyhood function can be considered as differential version of the (0-1) loss function.</li>
</ul>
<h3>
Optimizer - Graidient based methods for minimization</h3>
Let us consider a single data sample for the gradient computation ,Let the data sample belong to class <span class="math">(i)</span>.Corresponding to each output class we have a output matrix <span class="math">(W_i)</span> and bias vector <span class="math">(b_i)</span>.
We need to compute the gradients for all the elements of <span class="math">(W_i) </span> and <span class="math">(b_i)</span>
>
if N be the number of dimensions of input vector and M be the number of output classes.
<span class="math">$W_i$</span> will be a MxN vector and <span class="math">$b_i$</span> will be Mx1 vector
<br />
<ul>
<li>In the present application gradient based methods are used for minimization.</li>
<li>The cost function is expressed as
<div class="math">
\begin{eqnarray*} L(\theta,\mathcal{D}) = - log P(Y=y_i | X=x_i,W,b) \\ L(\theta,\mathcal{D}) = - log \frac {e^{W_i x + b_i}}{\sum_j e^{W_j x + b_j}} \\ L(\theta,\mathcal{D}) = - log {e^{W_i x + b_i}}- log {\sum_j e^{W_j x + b_j}} \\ L(\theta,\mathcal{D}) = - {W_i x + b_i} + log \frac{1}{\sum_j e^{W_j x + b_j}} \\ \end{eqnarray*}
\begin{align} \nabla_{\mathbf{w}_i}\ell(\mathbf{w}) =& \frac{\partial}{\partial \mathbf{w}_i}\left(\mathbf{w}_{i}^T\mathbf{x} - \log\left( \sum_{k'}^K \exp(\mathbf{w}_k^T\mathbf{x}) \right) \right)\\ =&\left(\frac{\partial}{\partial \mathbf{w}_i}\mathbf{w}_i^T\mathbf{x} - \frac{\partial}{\partial \mathbf{w}_i}\log\left( \sum_{k'}^K \exp(\mathbf{w}_i^T\mathbf{x}) \right) \right)\\ =& \left(\mathbf{x_i} - \frac{\mathbf{x_i}\exp(\mathbf{w}_i^T\mathbf{x})}{\sum_{k'}^K \exp(\mathbf{w}_i^T\mathbf{x})} \right) \end{align} For the all other (W_j) for which (j \ne i) \begin{align} \nabla_{\mathbf{w}_j}\ell(\mathbf{w}) =& \frac{\partial}{\partial \mathbf{w}_j}\left(\mathbf{w}_{i}^T\mathbf{x}_i - \log\left( \sum_{k'}^K \exp(\mathbf{w}_k^T\mathbf{x}) \right) \right)\\ =&\left(\frac{\partial}{\partial \mathbf{w}_j}\mathbf{w}_i^T\mathbf{x} - \frac{\partial}{\partial \mathbf{w}_j}\log\left( \sum_{k'}^K \exp(\mathbf{w}_i^T\mathbf{x}) \right) \right)\\ =& \left( - \frac{\mathbf{x}_j\exp(\mathbf{w}_j^T\mathbf{x})}{\sum_{k'}^K \exp(\mathbf{w}_k^T\mathbf{x})} \right) \end{align}</div>
</li>
</ul>
</div>
<br />
<br />
<ul>
<li>This can be computed in python as</li>
</ul>
<pre class="python"> """ function computes the negative log likelyhood over input dataset
params is optional argument to pass parameter to classifier
,useful in cases of iterative optimization routines for function evaluations like scipy.optimization package """
def negative_log_likelihood(self,params):
# args contains the training data
x,y=self.args;
self.update_params(params);
sigmoid_activation = pyvision.softmax(self.W,self.b,x);
index=[range(0,np.shape(sigmoid_activation)[0]),y];
p=sigmoid_activation[index]
l=-np.mean(np.log(p));
return l;
</pre>
<ul>
<li>The first part of the sum is affine,second is a log of sum of exponential's which is convex .Thus the loss function is convex and therefore has a unique global maxima/minima.</li>
<li>
<div class="math">
Thus we compute the derivatives of the loss function <span class="math">$L(\theta,\mathcal{D})) with respect to (\theta ,\partial{\ell}/\partial{W} \text{ and } \partial{\ell}/\partial{b}$</span></div>
</li>
<li>Different gradient based minimization exist like gradient descent,stochastic gradient descent,conjugate gradient descent etc.</li>
</ul>
The python code for computing gradients are<br />
<pre class="python"> """ function to compute the gradient of parameters for a single data sample """
def compute_gradients(self,out,y,x):
out=(np.reshape(out,(np.shape(out)[0],1)));
out[y]=out[y]-1;
W=out*x.T;
res=np.vstack((W.T,out.flatten()))
return res;
''' function to compute the gradient of loss function over all input samples'''
""" function to compute the gradient of loss function over all input samples
params is optional input parameter passed to the classifier,which is useful in cases
of iterative optimization routines,added for compatiblity with
scipi.optimization package """
def gradients(self,params=None):
# args contains the training data
x,y=self.args;
self.update_params(params);
sigmoid_activation = pyvision.softmax(self.W,self.b,x);
e = [ self.compute_gradients(a,c,b) for a, c,b in izip(sigmoid_activation,y,x)]
mean1=np.mean(e,axis=0);
mean1=mean1.T.flatten();
return mean1;
</pre>
The aim of gradient descent algorithms would be to take a small step along the direction of gradient to reach to global maxima.<br />
Thus gradient descent algorithms are characterized by the update and evaluate steps.At each iteration the values of parameters are updated ie (W,b) and then logistic loss function is evaluated wrt training data set.This process is repeated till we are certain that obtained set of parameters results in a global maximum values for negative log likelihood function.<br />
<h3>
Optimizer</h3>
we also do not use custom implementation of gradient descent algorithms rather the class implements<br />
optimizer using the newtons conjugate gradient method "<strong>fmin_cg"</strong> from the <strong>Scipy</strong> optimization package.The input to the optimizer are the evaluation function ,initial parameters and partial derivatives and output is the optimized parameters that maximuze the input functions.<br />
Callback functions are also specified which perform validation tests to computer the accuracy on the training database.<br />
<br />
To use the scipy optimization package we require the input to the functions to be the parameter values that need to be optimized .The functions evaluated at the optimized values are loss function,gradient or Hessian of loss functions.The output of optimization process are the optimized parameter values.The output of derivative function are the partial derivatives wrt the function evaluated at values specified by the input parameter value<br />
<br />
We define a class called Optimizer that performs optimization.It currently supports conjugate gradient descent and stochastic gradient descent algorithms.<br />
In the present article we will look at using the conjugate gradient descent algorithm<br />
The optimization function found in optimizer.py file corresponding to conjugate gradient descent algorithm is as below.<br />
<pre class="python">
self.iter=0;
index=self.iter;
batch_size=self.batch_size;
"""training data"""
x=self.training[0];
y=self.training[1];
"""training data batch for each iteration"""
train_input=x[index * batch_size:(index + 1) * batch_size];
train_output=y[index * batch_size:(index + 1) * batch_size];
train_output=np.array(train_output,dtype=int);
self.args=(train_input,train_output);
args=self.args;
"""setting the training data in LogisticRegression class"""
self.setdata(args);
"""gettting initial parameter from LogisticRegression class"""
self.params=self.init();
print "**************************************"
print "starting with the optimization process"
print "**************************************"
print "Executing nonlinear conjugate gradient descent optimization routines ...."
res=optimize.fmin_cg(self.cost,self.params,fprime=self.gradient,maxiter=self.maxiter,callback=self.local_callback);
print "**************************************"
print "completed with the optimization process"
</pre>
<div class="python">
self.cost corressponds to the negative_log_likelyhood method of LogisticRegression class</div>
<div class="python">
self.gradient corresponds to the gradients method of the LogisticRegression class</div>
<div class="python">
self.callback method corresponds to callback method in the Logisitic regression class,which is called at each iteration to update parameter values,computer Likeyhood and observer other statictics indicating how the optimization is proceeding.</div>
<br />
<br />
<div class="python">
In case of the scipy.optimization package,it computer the cost function and gradient values by passing parameter values to these functions,and performs paramer update based on the result returned by function and gradient evaluations.The parameter values are updated in the LogisticRegression whenever cost or gradient function are called.The parameter values are also updated in each callbackl iteration loop.</div>
<pre class="python"> """ the function performs training for logistic regression classifier """
def train(self,train,test,validate):
if self.n_dimensions==0:
self.labels=np.unique(train[1]);
n_classes = len(self.labels)
n_dimensions=np.shape(x)[1];
self.initialize_parameters(n_dimensions,n_classes);
"""create the optimizer class """
opti=Optimizer.Optimizer(10,"CGD",1,600);
"""set the training and validation datasets"""
opti.set_datasets(train,test,validate);
"""pass the cost,gradient and callback functions"""
opti.set_functions(self.negative_log_likelihood,self.set_training_data,self.classify,self.gradients,self.get_params,self.callback);
"""run the optimizer"""
opti.run();
</pre>
A class called "<strong style="color: black; font-family: Helvetica, Arial, sans-serif;">LogisticRegression</strong>" is defined which encapsulates the methods that are used to perform training and testing of multi-class Logistic Regression classifier.<br />
<h3>
TRAINING DATASET</h3>
<ul>
<li>For demonstration,we will use MNIST dataset The MNIST dataset consists of handwritten digit images and it is divided in 60,000 examples for the training set and 10,000 examples for testing. The official training set of 60,000 is divided into an actual training set of 50,000 examples and 10,000 validation examples All digit images have been size-normalized and centered in a fixed size image of 28 x 28 pixels. In the original dataset each pixel of the image is represented by a value between 0 and 255, where 0 is black, 255 is white and anything in between is a different shade of grey.</li>
<li>The dataset can be found at <a href="http://deeplearning.net/data/mnist/mnist.pkl.gz">http://deeplearning.net/data/mnist/mnist.pkl.gz</a>.</li>
<li>The data set is pickled can be loaded using python pickle package.</li>
<li>The data set consists of training,validation and test set.</li>
<li>The data set consists of feature vector of length $28x28=784$ and number of classes are 10.
<img height="120" src="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/repository/images/mnist_0.png" style="removed: move;" width="160" /> <img height="120" src="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/repository/images/mnist_1.png" style="removed: move;" width="160" /><img height="120" src="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/repository/images/mnist_2.png" style="removed: move;" width="160" /> </li>
</ul>
<pre class="python">''' MAIN FUNCTION '''
if __name__ == "__main__":
model_name1="/home/pi19404/Documents/mnist.pkl.gz"
data=LoadDataSets.LoadDataSets();
[train,test,validate]=data.load_pickle_data(model_name1);
x=train[0].get_value(borrow=True);
y=train[1].eval();
train=[x,y];
x=test[0].get_value(borrow=True);
y=test[1].eval();
test=[x,y];
x=validate[0].get_value(borrow=True);
y=validate[1].eval();
validate=[x,y];
classifier=LogisticRegression(0,0);
classifier.Regularization=0;
classifier.train(train,test,validate);
</pre>
Code for saving/loading the model files ,Passing parameters to optimization functions have not been implemented,these will be added in the future The output of the training process is shown below The conjugate gradient optimizer without regularization gives accuracy of 80% with 5 iterations<br />
<br />
<br />
... loading data /home/pi19404/Documents/mnist.pkl.gz<br />
number of dimensions : 784<br />
number of classes : 10<br />
number of training samples : 50000<br />
iteration : 0<br />
Loss function : 1.98470824149<br />
Validation error 0.39827999999999997<br />
iteration : 1<br />
Loss function : 1.35257458245<br />
Validation error 0.32438<br />
iteration : 2<br />
Loss function : 1.0896595289<br />
Validation error 0.27329999999999999<br />
iteration : 3<br />
Loss function : 0.928568922396<br />
Validation error 0.23626000000000003<br />
iteration : 4<br />
<strong style="color: black; font-family: Helvetica, Arial, sans-serif;">Loss function : 0.811558448986<br />
Validation error 0.20977999999999997</strong><br />
Warning: Maximum number of iterations has been exceeded<br />
Current function value: 0.811558<br />
Iterations: 5<br />
Function evaluations: 171<br />
Gradient evaluations: 171<br />
(50000, 784) (50000,)<br />
<h2>
CODE</h2>
<ul class="download">
<li><a href="http://www.codeproject.com/KB/recipes/821347/PyVision.zip">Download PyVision.zip - 3.5 KB</a></li>
<li><a href="https://github.com/pi19404/OpenVision/releases/download/PyVision/PyVision.tar">Alternate Link</a></li>
</ul>
<em><strong>The code can also be found at github code repository</strong></em><br />
<ul style="color: black; font-family: Helvetica, Arial, sans-serif;">
<li>The python code for Logistic Regression Classifier can be found at github repository<a href="https://github.com/pi19404/OpenVision/tree/master/ImgML/PyVision/LogisticRegression.py"> https://github.com/pi19404/OpenVision/tree/master/ImgML/PyVision/LogisticRegression.py</a> file.</li>
<li>The LoadDataSets.py contains methods to load datasets from pickel files ,LogisticRegression.py is the main file that implements the multiclass Logsitic Regression Classifier,while Optimizer.py contains the methods for handling optimization process.</li>
<li>You may need to install python packages numpy,scipy</li>
<li>You may need to install scikit machine learning package.The sklearn.metrics is used for accuracy metrics computation in validation methods of the LogsicticRegression class.</li>
</ul>
</div>
pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-86040345348066178462014-09-11T13:56:00.000+05:302014-09-11T13:56:06.435+05:30Restart Nautalis in Ubuntu 12.04<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: #f8f8f9; border: 0px; font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 16px; line-height: 28.43199920654297px; margin-bottom: 1.5em; orphans: 3; outline: 0px; padding: 0px; vertical-align: baseline; widows: 3;">
<span style="border: 0px; font-family: inherit; font-style: inherit; font-weight: 600; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Nautilus</span> is the default file manager/explorer in Ubuntu. </div>
<div style="background-color: #f8f8f9; border: 0px; font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 16px; line-height: 28.43199920654297px; margin-bottom: 1.5em; orphans: 3; outline: 0px; padding: 0px; vertical-align: baseline; widows: 3;">
Sometimes, you may need to kill and restart it to see the effect of installing or removing a program,if drivers are not displaying properly ,after installing some nautalis plugins or upgrades</div>
<div style="background-color: #f8f8f9; border: 0px; color: #666a76; font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 16px; line-height: 28.43199920654297px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter bash" id="highlighter_378757" style="background-color: white !important; border: 0px; font-family: inherit; font-size: 1em !important; font-style: inherit; font-weight: inherit; margin: 1em 0px !important; outline: 0px; overflow-x: auto !important; overflow-y: hidden !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 670.375px;">
<table border="0" cellpadding="0" cellspacing="0" style="-webkit-box-shadow: none !important; background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 670px;"><tbody style="-webkit-box-shadow: none !important; background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="-webkit-box-shadow: none !important; background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="-webkit-box-shadow: none !important; background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="-webkit-box-shadow: none !important; background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
</td><td class="code" style="-webkit-box-shadow: none !important; background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 633px;"><div class="container" style="-webkit-box-shadow: none !important; background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="-webkit-box-shadow: none !important; background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="bash plain" style="-webkit-box-shadow: none !important; background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-shadow: rgba(0, 0, 0, 0.0470588) 0px 1px 0px; top: auto !important; vertical-align: baseline !important; width: auto !important;">$ nautilus -q or </code><span style="background-color: initial; color: #333333; font-family: inconsolata-1, inconsolata-2; font-size: 19px; font-style: inherit; font-weight: inherit; line-height: 29.119998931884766px; white-space: normal;">killall nautilus</span><br />
<span style="background-color: initial; color: #333333; font-family: inconsolata-1, inconsolata-2; font-size: 19px; font-style: inherit; font-weight: inherit; line-height: 29.119998931884766px; white-space: normal;"><br /></span>
<span style="color: #333333; font-family: chaparral-pro-1, chaparral-pro-2; font-size: 21px; line-height: 29.119998931884766px; white-space: normal;">Then open nautilus via Unity menu </span></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: #f8f8f9; border: 0px; color: #666a76; font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 16px; line-height: 28.43199920654297px; margin-bottom: 1.5em; orphans: 3; outline: 0px; padding: 0px; vertical-align: baseline; widows: 3;">
<br /></div>
</div>
pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-30886207368014318112014-09-09T17:11:00.000+05:302014-09-09T17:11:49.991+05:30Install Gstreamer 1.0 in Ubuntu 12.04<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
Below are instructions to install gstreamer 1.0 on Ubuntu 12.04 OS.<br />
<br />
<br /></div>
<pre class="c++"><b>sudo apt-get install ubuntu-restricted-extras</b>
//backports from gstreamer developer ppa</pre>
<pre class="bash"><b>sudo add-apt-repository ppa:gstreamer-developers/ppa
sudo apt-get update</b></pre>
<pre class="bash">//install the base packages and plugins for gstreamer
<b>sudo apt-get install gstreamer1.0*</b>
</pre>
<pre class="bash"></pre>
</div>
pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-63589387819243907172014-08-23T01:20:00.001+05:302014-08-23T01:20:41.655+05:30Android Touch Gestures Capturing Interface<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<span style="border: 0px; color: #333333; font-size: 30px; margin: 0px; padding: 0px;">Introduction</span></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<span style="border: 0px; color: #333333; font-size: 30px; margin: 0px; padding: 0px;"><br /></span></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
In this article we will look at android application to capture touch gestures.This module is first part of generic touch based gesture recognition library.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<span style="border: 0px; color: #333333; font-size: 30px; margin: 0px; padding: 0px;">Background</span></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Gesture is a prerecorded touch screen motion sequency.Gesture recognition is an active research area in the field of pattern recognition,image analysis and computer vision.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
We will have several modes in which application can operate.One of options the user can select is to capture and store the candidate gesture.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The aim would be to build a generic C/C++ library that can store gestures is a user defined format.</div>
<h3 style="color: #ff9900; font-family: 'Segoe UI', Arial, sans-serif; font-size: 19px; font-weight: normal;">
Gesture Registration Android Interface</h3>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
This process of capturing and storing information about candidate gesture classes is called gesture registration. </div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
In the present article we will use the GestureOverlay method.A gesture overlay acts as a simple drawing board on which the user can draw his gestures. The user can modify several visual properties, like the color and the width of the stroke used to draw gestures, and register various listeners to follow what the user is doing.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
To capture gestures and process them first stem is to add a GestureOverlayView to store_gesture.xml XML layout file.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px;">
......
......
<android .gesture.gestureoverlayview="" android:eventsinterceptionenabled="true" android:gesturestroketype="multiple" android:id="@+id/gestures" android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical">
<linearlayout android:layout_height="wrap_content" android:layout_width="match_parent" android:orientation="horizontal" style="android: style/ButtonBar;">
<button android:enabled="false" android:id="@+id/done" android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="0dip" android:onclick="addGesture" android:text="@string/button_done">
<button android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="0dip" android:onclick="cancelGesture" android:text="@string/button_discard">
</button></button></linearlayout>
</android>
</pre>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Some properties of gesture overlay are specified that the gestures stroke type is single indicating uni-stroke gestures.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Now in the main activity file we just need to set the content view to the layout file.In the present application the name of layout file is "activity_open_vision_gesture.xml".</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Since we also need to capture or process the gesture once they are performed we add a gesture listerner to the overlay.The most commonly used listener is GestureOverlayView.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
OnGesturePerformedListener which fires whenever a user is done drawing a gesture.We use a class <strong style="border: 0px; margin: 0px; padding: 0px;">GesturesProcessor </strong>that implements the GestureOverlayListner.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Once the gesture is drawn by the user the control flow enters the <strong style="border: 0px; margin: 0px; padding: 0px;">onGestureEnded </strong>method.Here we copy the gesture and can perform host of activities like storing,predicting etc.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Below is a image of the UI Interface</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<img alt="" data-cke-saved-src="http://www.codeproject.com/KB/Articles/808616/sc3.png" src="http://www.codeproject.com/KB/Articles/808616/sc3.png" style="border: 0px; cursor: default; height: 240px; margin: 0px; padding: 0px; width: 141px;" /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<pre lang="java" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px;">private class GesturesProcessor implements GestureOverlayView.OnGestureListener {
public void onGestureStarted(GestureOverlayView overlay, MotionEvent event) {
mDoneButton.setEnabled(false);
mGesture = null;
}
public void onGesture(GestureOverlayView overlay, MotionEvent event) {
}
<strong style="border: 0px; margin: 0px; padding: 0px;"> //callback function entered when the gesture registration is completed</strong>
public void onGestureEnded(GestureOverlayView overlay, MotionEvent event) {
<strong style="border: 0px; margin: 0px; padding: 0px;"> //copy the gesture to local variable</strong>
mGesture = overlay.getGesture();
<strong style="border: 0px; margin: 0px; padding: 0px;"> //ignore the gesture if length is below a threshold</strong>
if (mGesture.getLength() < LENGTH_THRESHOLD) {
overlay.clear(false);
}
<strong style="border: 0px; margin: 0px; padding: 0px;"> //enable the store button</strong>
mDoneButton.setEnabled(true);
}
public void onGestureCancelled(GestureOverlayView overlay, MotionEvent event) {
}
}
</pre>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Upon clicking the store button the program enters "onStore" callback function.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<pre lang="java" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px;"> public void addGesture(View v) {
Log.e("CreateGestureActivity","Adding Gestures");
<strong style="border: 0px; margin: 0px; padding: 0px;">//function which extracts information from the Android Gesture Objects like locations and then make native library function calls to store the gesture</strong>
extractGestureInfo();
}
</pre>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
We define all the JNI Interface functions in the class <strong style="border: 0px; margin: 0px; padding: 0px;">GestureLibraryInterface.</strong>We define 2 JNI Interface calls to the native C/C++ gesture library</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<pre lang="java" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px;">public class GestureLibraryInterface {
static{Loader.load();}
<strong style="border: 0px; margin: 0px; padding: 0px;"> //makes native calls to GestureLibrary to store gesture information in local filesystem</strong>
public native static void addGesture(ArrayList%lt;Float> location,ArrayList<long> time,String name);
<strong style="border: 0px; margin: 0px; padding: 0px;"> //make native calls to GestureLibrary to set the gesture directory</strong>
public native static void setDirectory(String name);
}
</long></pre>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The first step is to set the directory where the Gestures will be stored by making the "<strong style="border: 0px; margin: 0px; padding: 0px;">setDirectory</strong>" call.This is done when the AndroidActivity is initialized in the "<strong style="border: 0px; margin: 0px; padding: 0px;">onCreate</strong>" function.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<pre lang="java" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px;"> @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.store_gesture);
mDoneButton = findViewById(R.id.done);
eText = (EditText) findViewById(R.id.gesture_name);
GestureOverlayView overlay = (GestureOverlayView) findViewById(R.id.gestures);
overlay.addOnGestureListener(new GesturesProcessor());
GestureLibraryInterface.setDirectory(DIR);
}
</pre>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The extractGestureInfo reads the gesture strokes and stores the locations in ArrayList which is passed to native C/C++ using JNI Interface.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<pre lang="java" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px;">.....
private static final String DIR=Environment.getExternalStorageDirectory().getPath()+"/AndroidGesture/v1";
....
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//load the store activity GUI layoyt files
setContentView(R.layout.store_gesture);
//gets the store button object
mDoneButton = findViewById(R.id.done);
//get the EditText object
eText = (EditText) findViewById(R.id.gesture_name);
//configures the gestureOverLay Listener
GestureOverlayView overlay = (GestureOverlayView) findViewById(R.id.gestures);
overlay.addOnGestureListener(new GesturesProcessor());
//gets the gesture directory
GestureLibraryInterface.setDirectory(DIR);
}
</pre>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The JNI C/C++ codes associated with the java class are defined in the file <strong style="border: 0px; margin: 0px; padding: 0px;">GestureLibraryInterface.cpp and GestureLibraryInterface.hpp files</strong></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<strong style="border: 0px; margin: 0px; padding: 0px;"><br /></strong></div>
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px;"><strong style="border: 0px; margin: 0px; padding: 0px;">//function calls the GetureRegognizer methods to add gesture to class path</strong>
JNIEXPORT void JNICALL Java_com_openvision_androidgesture_GestureLibraryInterface_addGesture(JNIEnv *, jobject, jobject, jobject, jstring);
<strong style="border: 0px; margin: 0px; padding: 0px;">//function calls the GestureRecognizer methods to set the main gesture directory path</strong>
JNIEXPORT void JNICALL Java_com_openvision_androidgesture_GestureLibraryInterface_setDirectory(JNIEnv *, jobject, jstring);
<strong style="border: 0px; margin: 0px; padding: 0px;">//Utility functions to convert from jobject datatype to float and Long</strong>
float getFloat(JNIEnv *env,jobject value);
long getLong(JNIEnv *env,jobject value);
</pre>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The UniStrokeGesture Library consits of the following files</div>
<ul style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 10px 0px; padding: 0px 0px 0px 40px;">
<li style="border: 0px; margin: 0px; padding: 0px;">UniStrokeGestureLibary</li>
<li style="border: 0px; margin: 0px; padding: 0px;">UniStrokeGesture</li>
<li style="border: 0px; margin: 0px; padding: 0px;">GesturePoint</li>
</ul>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The <strong style="border: 0px; margin: 0px; padding: 0px;">UniStrokeGestureLibrary</strong> Class encapsulates all the properties of Unistroke gestures.It contains methods for storing,retriving and predicting the gestures amongst others.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The "addGesture" JNI Method calls the save routine implemented in the class to Store the Gestures</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The <strong style="border: 0px; margin: 0px; padding: 0px;">UniStrokeGestureLibrary</strong> consists of a sequence of objects of type <strong style="border: 0px; margin: 0px; padding: 0px;">UniStrokeGesture</strong>.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The objects of class <strong style="border: 0px; margin: 0px; padding: 0px;">UniStrokeGesture</strong> encapsulates all the properties of single gesture class.<strong style="border: 0px; margin: 0px; padding: 0px;">UniStrokeGesture</strong> Class contains facility to store multiple instances of sample gesture,as <strong style="border: 0px; margin: 0px; padding: 0px;">UniStroke</strong> Gesture can be represented by multiple candidated instances. </div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The <strong style="border: 0px; margin: 0px; padding: 0px;">UniStrokeGesture</strong> is contains as sequence of objects of type <strong style="border: 0px; margin: 0px; padding: 0px;">GesturePoint.</strong>Each Gesture points represents a element of UniStrokeGesture and is characterized by its location in 2D grid.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<pre lang="C++" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px;">/**
* function that stores the Gesture to a specified directory
*/
void UniStrokeGestureRecognizer::save(string dir,vector<gesturepoint> points)
{
char abspath1[1000],abspath2[1000];
sprintf(abspath1,"%s/%s",_path.c_str(),dir.c_str());
int count=0;
<strong style="border: 0px; margin: 0px; padding: 0px;">//check if directory exists else create it</strong>
int ret=ImgUtils::createDir((const char *)abspath1);
count=ImgUtils::getFileCount(abspath1);
sprintf(abspath2,"%s/%d.csv",abspath1,count);
<strong style="border: 0px; margin: 0px; padding: 0px;"> //writing contents to file in csv format</strong>
ofstream file(abspath2,std::ofstream::out);
for(int i=0;i<points .size="" file.close="" file="" gesturepoint="" i="" p.position.x="" p.position.y="" p="points[i];" strong="" style="border: 0px; margin: 0px; padding: 0px;"> //creating a bitmap while storing the CSV file</points></gesturepoint></pre>
</div>
generateBitmap(abspath2);
}
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Consider an example of gesture stored in CSV format</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<a data-cke-saved-href="http://www.codeproject.com/KB/Articles/808616/1.csv.zip" href="http://www.codeproject.com/KB/Articles/808616/1.csv.zip" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">1.CSV</a></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<img alt="" data-cke-saved-src="http://www.codeproject.com/KB/Articles/808616/sc5.png" src="http://www.codeproject.com/KB/Articles/808616/sc5.png" style="border: 0px; cursor: default; height: 240px; margin: 0px; padding: 0px; width: 141px;" /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The <strong style="border: 0px; margin: 0px; padding: 0px;">generateBitMap</strong> fuction loads the gesture points from the input csv file and generates a bitmap image that is suitable for display</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px;">void UniStrokeGestureRecognizer::generateBitmap(string file)
{
string basedir=ImgUtils::getBaseDir(file);
string name=ImgUtils::getBaseName(file);
string line;
//ifstream classFile(file.c_str());
float x,y;
cv::Mat image=cv::Mat(640,480,CV_8UC3);
image.setTo(cv::Scalar::all(0));
Point x1,x2,x3;
int first=-1;
int delta=20;
vector<gesturepoint> points;
//loading the gesture from CSV file
points=loadTemplateFile(file.c_str(),"AA");
//getting the bounding box
Rect R=boundingBox(points);
//drawing the gesture
int i=0;
cv::circle(image,cv::Point((int)points[i].position.x,(int)points[i].position.y),3,cv::Scalar(255,255,0),-1,CV_AA);
for(i=1;i<points .size="" i="" point="" r.width="" r="Rect(max(0,R.x-delta),max(0,R.y-delta),R.width+2*delta,R.height+2*delta);" x1="cv::Point((int)points[i].position.x,(int)points[i].position.y);" x2="cv::Point((int)points[i-1].position.x,(int)points[i-1].position.y);">image.cols)
R.width=image.cols-R.x-1;
if(R.y+R.height>image.rows)
R.height=image.rows-R.y-1;
//extract the ROI
Mat roi=image(R);
Mat dst;
cv::resize(roi,dst,Size(640,480));
string bmpname=basedir+"/"+name+".bmp";
//save the bitmap
cv::imwrite(bmpname,dst);
}
</points></gesturepoint></pre>
<h3 style="color: #ff9900; font-family: 'Segoe UI', Arial, sans-serif; font-size: 19px; font-weight: normal;">
Display the Gesture List</h3>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The next part of the application deals with displaying the gesture created in the above section on the Android UI.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Upon starting the application all the bmp files in the template directory are loaded</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The activity of loading the gestures the bitmaps is done in background asynchronously.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
In android a ListView is used to display the gesture bitmaps and associated text.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Layout each item of the list is defined in the file gesture_item.xml</div>
<pre style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px;"><textview android:drawablepadding="12dip" android:ellipsize="marquee" android:gravity="center_vertical" android:id="@android:id/text1" android:layout_height="wrap_content" android:layout_width="match_parent" android:minheight="?android:attr/listPreferredItemHeight" android:paddingleft="6dip" android:paddingright="6dip" android:singleline="true" android:textappearance="?android:attr/textAppearanceLarge" xmlns:android="http://schemas.android.com/apk/res/android">
</textview></pre>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The layout for ListView is defined in the main layout file activity_open_vision.xml</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The <strong style="border: 0px; margin: 0px; padding: 0px;">displayGestures </strong>function defined in OpenVisionGesture.java.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
A object of type "<strong style="border: 0px; margin: 0px; padding: 0px;">AsyncTask</strong>",GesturesLoadTask is defined in the main class files.This methods of these classes is called from the displayGestures function,which loads the gesture list in the background.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The objects of class ArrayTask reuire three methods to be defined.</div>
<ul style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 10px 0px; padding: 0px 0px 0px 40px;">
<li style="border: 0px; margin: 0px; padding: 0px;">doInBackground - main function executed in the background</li>
<li style="border: 0px; margin: 0px; padding: 0px;">onPreExecute - the function invoked before background task is executed</li>
<li style="border: 0px; margin: 0px; padding: 0px;">onPostExecute - the function invoked after the background task has executed</li>
<li style="border: 0px; margin: 0px; padding: 0px;"><a data-cke-saved-href="http://developer.android.com/reference/android/os/AsyncTask.html#onProgressUpdate(Progress...)" href="http://developer.android.com/reference/android/os/AsyncTask.html#onProgressUpdate(Progress...)" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">onProgres</a>sUpdate - the function can be used to update UI contents while background task is executing</li>
</ul>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
In the background task ,the code parses throught the gesture template directory and reads all the bitmap files.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
An <strong style="border: 0px; margin: 0px; padding: 0px;">ArrayAdapter</strong> takes an Array and converts the items into View objects to be loaded into the <strong style="border: 0px; margin: 0px; padding: 0px;">ListView</strong> container.We define an adapter which maintains a <strong style="border: 0px; margin: 0px; padding: 0px;">NamedGesture</strong> objects which contain the gesture name and identifier.The "<strong style="border: 0px; margin: 0px; padding: 0px;">getView</strong>" function in the <strong style="border: 0px; margin: 0px; padding: 0px;">ArrayAdapter</strong> class is responsible for converting the java object to View.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
we maintain a List of Bitmaps identified by a ID as well as List of Gesture names represented by the SameID.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
When ever a bitmap is read we update the lists and GUI so that it can be displayed by calling the "<strong style="border: 0px; margin: 0px; padding: 0px;">publishProgress</strong>" function which leads to onProgressUpdate function being called in the main UI thread.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Using this approach we can see the bitmaps being populated with time</div>
<pre lang="java" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px;"> @Override
protected Integer doInBackground(Void... params) {
if (isCancelled()) return STATUS_CANCELLED;
if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
return STATUS_NO_STORAGE;
}
Long id=new Long(0);
File list = new File(CreateGestureActivity.DIR);
<strong style="border: 0px; margin: 0px; padding: 0px;"> //get list of template classes</strong>
File[] files = list.listFiles(new DirFilter());
for(int i=0;i<files .length="" i="" strong="" style="border: 0px; margin: 0px; padding: 0px;"> //get list of image files in the template folder</files></pre>
File[] list1=files[i].listFiles(new ImageFileFilter());
for(int k=0;k<list1 .length="" k="" strong="" style="border: 0px; margin: 0px; padding: 0px;"> //load the image files</list1>
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = BitmapFactory.decodeFile(list1[k].getPath(), options);
Bitmap ThumbImage = ThumbnailUtils.extractThumbnail(bitmap, mThumbnailSize, mThumbnailSize);
final NamedGesture namedGesture = new NamedGesture();
namedGesture.id=id;
namedGesture.name = files[i].getName()+"_"+list1[k].getName();
<strong style="border: 0px; margin: 0px; padding: 0px;"> //add bitmap to hashtable</strong>
mAdapter.addBitmap((Long)id, ThumbImage);
id=id+1;
<strong style="border: 0px; margin: 0px; padding: 0px;"> //update the GUI</strong>
publishProgress(namedGesture);
bitmap.recycle();
}
}
return STATUS_SUCCESS;
}
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Once the add function in adapter is called ,the UI ListView is updated by displaying the gesture name and associated bitmap in the "getView" function</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<pre lang="java" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto !important; padding: 6px;"> @Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
<strong style="border: 0px; margin: 0px; padding: 0px;"> //view associated with individual gesture item</strong>
convertView = mInflater.inflate(R.layout.gestures_item, parent, false);
}
<strong style="border: 0px; margin: 0px; padding: 0px;"> //get the gesture at specified position in the listView</strong>
final NamedGesture gesture = getItem(position);
final TextView label = (TextView) convertView;
<strong style="border: 0px; margin: 0px; padding: 0px;"> //set the gesture names</strong>
label.setTag(gesture);
label.setText(gesture.name);
<strong style="border: 0px; margin: 0px; padding: 0px;"> //get the bitmap from hashtable identified by id and display bitmap to left of text</strong>
label.setCompoundDrawablesWithIntrinsicBounds(mThumbnails.get(gesture.id),null, null, null);
return convertView;
}
</pre>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<img alt="" data-cke-saved-src="http://www.codeproject.com/KB/Articles/808616/sc6.png" src="http://www.codeproject.com/KB/Articles/808616/sc6.png" style="border: 0px; cursor: default; height: 480px; margin: 0px; padding: 0px; width: 281px;" /></div>
<h3 style="color: #ff9900; font-family: 'Segoe UI', Arial, sans-serif; font-size: 19px; font-weight: normal;">
<strong style="border: 0px; margin: 0px; padding: 0px;">Code</strong></h3>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The files found in the ImgApp Directory form the <a data-cke-saved-href="http://www.github.com/pi19404/OpenVision" href="http://www.github.com/pi19404/OpenVision" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">OpenVision</a> repository and can be found at github repository <a data-cke-saved-href="http://www.github.com/pi19404/OpenVision" href="http://www.github.com/pi19404/OpenVision" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">www.github.com/pi19404/OpenVision.</a></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The complete android project can be found at <strong style="border: 0px; margin: 0px; padding: 0px;">samples/Android/AndroidGestureCapture</strong><strong style="border: 0px; margin: 0px; padding: 0px;"> </strong>directory in <strong style="border: 0px; margin: 0px; padding: 0px;">OpenVision </strong>repository<strong style="border: 0px; margin: 0px; padding: 0px;">.</strong>This<strong style="border: 0px; margin: 0px; padding: 0px;"> </strong>is android project source package and can be directly imported onto eclipse and run directly.The application was tested on Mobile device with Android Version 4.1.2.Compatibility with other Android OS versions has not been tested or kept in consideration while developing the application.</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
You need to have OpenCV installed on you system.The present application was developed on Ubuntu 12.04 OS.The paths in the Android.mk are specified based on this.For windows or other OS or if OpenCV paths are different modify the make file accordingly</div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The apk and source File Can be downloaded from</div>
<ul class="download" style="border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 25px 0px 10px; padding: 0px 0px 0px 40px;">
<li style="background-attachment: scroll; background-clip: initial; background-image: url(http://dj9okeyxktdvd.cloudfront.net/images/download24.png); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat; background-size: initial; border: 0px; font-weight: bold; list-style-type: none; margin: 0px 0px 6px -40px; padding: 0px 0px 1px 30px; vertical-align: middle;"><a data-cke-saved-href="https://github.com/pi19404/OpenVision/releases/download/OpenVision/AndroidGesture.apk" href="https://github.com/pi19404/OpenVision/releases/download/OpenVision/AndroidGesture.apk" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Download APK File - 20.8 MB</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url(http://dj9okeyxktdvd.cloudfront.net/images/download24.png); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat; background-size: initial; border: 0px; font-weight: bold; list-style-type: none; margin: 0px 0px 6px -40px; padding: 0px 0px 1px 30px; vertical-align: middle;"><a data-cke-saved-href="https://github.com/pi19404/OpenVision/archive/master.zip" href="https://github.com/pi19404/OpenVision/archive/master.zip" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Download Entire OpenVision Library Source</a></li>
</ul>
<div style="color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<br /></div>
pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-82406993003449849442014-08-20T13:39:00.001+05:302014-08-20T13:40:50.125+05:30Compiling Native C/C++ library for Android<div dir="ltr" style="text-align: left;" trbidi="on">
<h1>
Introduction</h1>
This article describes method to cross compile C/C++ library for mobile devices which use Android OS.<br />
<h2>
<span style="color: #333333; font-size: 30px;">Installation and Code Compilation</span></h2>
Before Proceeding make sure that you have all the below software components installed and configured in Eclipse<br />
<ul>
<li>Eclipse IDE</li>
</ul>
<ul>
<li>Android SDK
<ul>
<li><span style="background-color: white; color: black; font-family: 'Times New Roman'; font-size: 13px; text-align: -webkit-auto;"><span style="background-color: transparent; font-family: Arial; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: x-small;">Eclipse -> Window -> Preferences -> Android -> set path to SDK</span></span></span></li>
</ul>
</li>
<li>Android NDK
<ul>
<li><span style="background-color: white; color: black; font-family: 'Times New Roman'; font-size: 13px; text-align: -webkit-auto;"><span style="background-color: transparent; font-family: Arial; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: x-small;"><span style="background-color: white; color: black; font-family: 'Times New Roman'; font-size: 13px; text-align: -webkit-auto;"><span style="background-color: transparent; font-family: Arial; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: x-small;">Eclipse -> Window -> Preferences -> Android -> NDK -> set path to the NDK</span></span></span></span></span></span></li>
</ul>
</li>
<li>ADT and NDK plugin for Eclipse
<ul>
<li><span style="color: black; font-family: 'Times New Roman';"><span style="font-size: x-small;"><span style="background-color: transparent; font-family: Arial; vertical-align: baseline; white-space: pre-wrap;">Install Android SDK + NDK Plugins from Eclipse update site </span><a href="https://dl-ssl.google.com/android/eclipse/" style="color: #0033cc; text-decoration: underline;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; vertical-align: baseline; white-space: pre-wrap;">https://dl-ssl.google.com/android/eclipse/</span></a><span style="background-color: transparent; font-family: Arial; vertical-align: baseline; white-space: pre-wrap;"> </span></span></span></li>
</ul>
</li>
<li>Eclipse CDT for C/C++ support
<ul>
<li><span style="color: black; font-family: 'Times New Roman';"><span style="font-size: x-small;"><span style="background-color: transparent; font-family: Arial; vertical-align: baseline; white-space: pre-wrap;">Install CDT from Eclipse update site </span><a href="http://download.eclipse.org/tools/cdt/releases/indigo" style="color: #0033cc; text-decoration: underline;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; vertical-align: baseline; white-space: pre-wrap;">http://download.eclipse.org/tools/cdt/releases/indigo</span></a><span style="background-color: transparent; font-family: Arial; vertical-align: baseline; white-space: pre-wrap;">.</span></span></span></li>
</ul>
</li>
</ul>
Develop the code on Desktop Computer and check if you are able to compile it properly without errors.<br />
The present example consists of files containing following classes<br />
<ul>
<li>UniStrokeGestureRecognizer</li>
<li>UniStrokeGesture</li>
<li>GesturePoint</li>
</ul>
The library libOpenVision.so has been successfully compiled on the Ubuntu OS and now we proceed with cross compilation of the library for ARM based mobile devices which use the Android OS.<br />
<span style="color: #333333; font-size: 30px;">Cross Compilation</span><br />
The simplest approach to do this is to use the Eclipse IDE.The Eclipse IDE provides features for adding native C/C++ support to an existing Android based project.<br />
The project name is AndroidGesture.Right click on an Android project and<br />
select Android Tools -> Add native support.<br />
And enter the desired library name as <strong>OpenVision</strong><br />
This will configure the AndroidProject for the native build.Create a <strong>jni</strong> folder with <strong>OpenVision.cpp</strong> file and associated <strong>Android.mk</strong> make file<br />
Copy the all the C/C++ project files in the jni folder and then proceed to modify the Android.mk file to configure for native build.<br />
Create a directory called OpenVision in the jni directory<br />
Copy all of the following files in the ImageApp subdirectory<br />
<ul>
<li>UniStrokeGestureRecognizer.cpp</li>
<li>UniStrokeGestureRecognizer.hpp</li>
<li>UniStrokeGesture.cpp</li>
<li>UniStrokeGesture.hpp</li>
<li>GesturePoint.cpp</li>
<li>GesturePoint.hpp</li>
</ul>
Copy the file OpenCVCommon.hpp in the Common Subdirectory<br />
The preset code uses OpenCV libraries.Copy the attached OpenCV pre-compiled libraries for ARM in the libs/armeabi and libs/armeabi2 directories.<br />
<span style="color: #333333; font-size: 30px;">MakeFiles</span><br />
below are the contents of Android.mk file.This file is like a standard make file containing the include paths,source files,library dependencies etc.Few of the syntaxes are specific to android build and explanation is provided in the comments<br />
<strong>Android.mk file</strong><br />
<pre lang="text" style="background-color: #ddffdd;">LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# name of the library to be built
LOCAL_MODULE := OpenVision
#list of source files to be build as part of the library
LOCAL_SRC_FILES := ImgApp/GesturePoint.cpp ImgApp/UniStrokeGesture.cpp ImgApp/UniStrokeGestureRecognizer.cpp
# list of dependent 3rd party or external libraries are included in the LOCAL_SHARED_LIBRARY variable
LOCAL_SHARED_LIBRARIES := $(foreach module,$(OPENCV_LIBS3),opencv_$(module))
OPENCV_MODULES3:=core imgproc flann contrib features2d video highgui legacy ml objdetect
OPENCV_LIBS3:=$(OPENCV_MODULES3)
# list of dependent system libraries
LOCAL_LDLIBS += -fPIC -llog -ldl -lm -lz -lm -lc -lgcc -Wl,-rpath,'libs/armeabi-v7a'
LOCAL_LDLIBS += -L$(LOCAL_PATH)/../libs/armeabi -llog -Llibs/armeabi-v7a/
# include path for header files for C and C++ applications
LOCAL_C_INCLUDES +=/usr/local/include /usr/local/include/opencv2 /home/pi19404/repository/OpenVision/OpenVision
LOCAL_CPP_INCLUDES +=/usr/local/include /usr/local/include/opencv2 /home/pi19404/repository/OpenVision/OpenVision
#The compilation flags for C/C++ applications
LOCAL_CPPFLAGS += -DHAVE_NEON -fPIC -DANDROID -I/usr/local/include/opencv -I/usr/local/include -I/OpenVision -I/home/pi19404/repository/OpenVision/OpenVision -fPIC
LOCAL_CFLAGS += -DHAVE_NEON -fPIC -DANDROID -I/usr/local/include/opencv -I/usr/local/include -I/OpenVision -I/home/pi19404/repository/OpenVision/OpenVision -fPIC
LOCAL_CPP_FEATURES += exceptions
#statement specifies build of a shared library
include $(BUILD_SHARED_LIBRARY)
#files in the libs/armeabi are deleted during each build
#we need to have 3rd party opencv libraries in this directory
#the files are placed in the armeabi2 directory
#when ever a native build is trigged the opencv library files specified in the OPENCV_MODULES2
#variable are copied from the armeabi2 directory to the armeabi or armeabi-v7a directory
#as per the specification of APP_ABI in the Application.mk file
include $(CLEAR_VARS)
OPENCV_MODULES2:= calib3d contrib core features2d flann highgui imgproc legacy ml nonfree objdetect photo stitching video videostab
OPENCV_LIBS2:=$(OPENCV_MODULES2)
OPENCV_LIB_SUFFIX:=so
OPENCV_LIB_TYPE:=SHARED
define add_opencv_module1
include $(CLEAR_VARS)
LOCAL_PATH := libs/armeabi2
LOCAL_MODULE:=aaaopencv_$1
LOCAL_SRC_FILES:=libopencv_$1.$(OPENCV_LIB_SUFFIX)
include $(PREBUILT_$(OPENCV_LIB_TYPE)_LIBRARY)
endef
$(foreach module,$(OPENCV_LIBS2),$(eval $(call add_opencv_module1,$(module))))
</pre>
<strong>Application.mk make file</strong><br />
<pre lang="text" style="background-color: #ddffdd;">APP_ABI := armeabi-v7a armeabi
APP_STL := gnustl_static
APP_PLATFORM := android-8
APP_CPPFLAGS := -frtti -fexceptions -ftree-vectorize -mfpu=neon -O3 -mfloat-abi=softfp -ffast-math
</pre>
<br />
After building the project the libOpenVision.so files can be found in the libs/armeabi and libs/armeabi-v7a directories.These have been cross-compiled for use on android based devices.<br />
These can now be loaded and called from java application using JNI Interface<br />
<h2>
<strong style="color: #333333; font-size: 30px;">Files</strong></h2>
The pre compiled opencv libraries for Android can be found at <a href="http://www.github.com/pi19404/OpenCVAndroid">www.github.com/pi19404/OpenCVAndroid</a><br />
The source and make files used above came be found in the OpenVision repository at <a href="http://www.github.com/pi19404/OpenVision">www.github.com/pi19404/OpenVision</a><br />
The Android.mk and Application.mk files and contents of jni directory can be found below<br />
<ul class="download">
<li><a href="https://draft.blogger.com/source_jni.zip">Download Source - 5.6 KB</a></li>
</ul>
</div>
pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-18183950104850811062014-04-24T01:54:00.001+05:302014-08-12T09:19:39.688+05:30Adaptive Skin Color Detector <h1>
<div class="allcaps">
Adaptive Skin Color Detection</div>
</h1>
<h4>
Introduction</h4>
In this article we will look at Adaptive Skin Color Detection technique described in the paper \cite{Dadgostar:2006:ARS:1151986.1151991}.<br />
<ul>
<li>Skin Color can be efficiently represented using Hue channel of HSV color space.</li>
<li>A static Skin color detector/Global Skin color detection can be specified by low and higher hue thresholds.</li>
<li>The hue range specified global skin color detector should detect the aactual skin colored pixels ,but it would also falsely detect some non skin colored pixels belonging to background or objects with similar hue color as skin like wood etc</li>
<li>The ammount of falsely detected pixels may be large in some situtations compared to actual skin pixels,if a significant ammount of scence contains objects with hue similar to the skin color.</li>
<li>The choise of image aquisition system,lighting conditions,pre-processing etc affect the choice of hue thresholds.</li>
<li>Hence the optimum thresholds needs to be decided adaptively.</li>
<li>In HCI applications hand or face regions are used to communicate with the computer and assuming that dominant motion in the scene belongs to hand and skin pixels.</li>
<li>One of the ways to detect the regions belonging to skin regions is motion tracking.</li>
<li>The Hue thresholds are adaptively changed by observing the motion of skin colored pixels in the image.</li>
<li>Thus the first step is to determine the in motion skin colored pixels.<h4>
Global Skin Colored Detector</h4>
</li>
<li>A Global Skin Colored Detector is specified by lower and upper Hue thresholds and lower and higher intensity thresholds.</li>
<li>Initals lower and upper hue thresholds are chosen as 3 and 33.</li>
<li>The Hue range provided is a generic thresholds that will cover all the possible skin colors.</li>
<li>Due to the generic nature of the skin threshold,some background objects whose hue is similar to skin or falls within the specified threshold may also be detected.</li>
<li>The initial lower and higher intensity thresholds are chosen as 15 and 250.</li>
<li>The thresholds are choosen such to avoid over or under-exposed regions in the images.<h4>
Skin Color Histogram</h4>
</li>
<li>The filtered skin colored pixels can be used to construct a skin colored histogram which represents the statistical distribution of the skin colored pixels in the scene.</li>
<li>In case of global Skin colored detector,this histogram also accumulates the data due to background pixles.</li>
<li>Let us known assume that we known the pixels that belong to hand or face pixels.</li>
<li>We again compute the histogram of skin colored pixels.</li>
<li>The Actual Skin Colored histogram is merged with original skin colored histogram</li>
<li>The histograms are combined using a weighted average<span class="MathJax_Preview" style="color: #888888;"></span><div aria-readonly="true" class="MathJax_Display" role="textbox" style="margin: 1em 0em; max-height: none; max-width: none; min-height: 0px; min-width: 0px; position: relative; text-align: center; width: 1289px;">
<span class="MathJax" id="MathJax-Element-1-Frame" style="border: 0px; direction: ltr; display: inline; float: none; font-size: 16px; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; padding: 0px; text-align: left; white-space: nowrap; word-spacing: normal; word-wrap: normal;"><nobr style="-webkit-transition: none; border: 0px; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; padding: 0px; transition: none; vertical-align: 0px;"><span class="math" id="MathJax-Span-1" style="-webkit-transition: none; border: 0px; display: inline-block; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 12.018em;"><span style="-webkit-transition: none; border: 0px; display: inline-block; font-size: 19px; height: 0px; margin: 0px; padding: 0px; position: relative; transition: none; vertical-align: 0px; width: 10.348em;"><span style="-webkit-transition: none; border: 0px; clip: rect(1.188em 1000.003em 2.697em -0.482em); left: 0.003em; margin: 0px; padding: 0px; position: absolute; top: -2.206em; transition: none; vertical-align: 0px;"><br /><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 2.212em; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 0px;"></span></span></span><span style="-webkit-transition: none; border-left-style: solid; border-width: 0px 0px 0px 0.003em; display: inline-block; height: 1.503em; margin: 0px; overflow: hidden; padding: 0px; position: static; transition: none; vertical-align: -0.434em; width: 0px;"></span></span></nobr></span></div>
</li>
<li>A good result is obtained by choosing a value in the range 0.02-0.05 for a.</li>
<li>For each frame the range of hue thresholds are re-calculated based on new histogram.</li>
<li>The criteria used for selection of lower and upper thresholds is such that area under the histogram covers <span class="MathJax_Preview" style="color: #888888;"></span><span aria-readonly="true" class="MathJax" id="MathJax-Element-2-Frame" role="textbox" style="border: 0px; direction: ltr; display: inline; float: none; font-size: 16px; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; padding: 0px; white-space: nowrap; word-spacing: normal; word-wrap: normal;"><nobr style="-webkit-transition: none; border: 0px; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; padding: 0px; transition: none; vertical-align: 0px;"><span class="math" id="MathJax-Span-6" style="-webkit-transition: none; border: 0px; display: inline-block; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 1.727em;"><span style="-webkit-transition: none; border: 0px; display: inline-block; font-size: 19px; height: 0px; margin: 0px; padding: 0px; position: relative; transition: none; vertical-align: 0px; width: 1.457em;"><span style="-webkit-transition: none; border: 0px; clip: rect(1.996em 1000.003em 3.289em -0.428em); left: 0.003em; margin: 0px; padding: 0px; position: absolute; top: -2.907em; transition: none; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-7" style="-webkit-transition: none; border: 0px; display: inline; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;"><span class="mi" id="MathJax-Span-8" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Math; font-style: italic; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">f<span style="-webkit-transition: none; border: 0px; display: inline-block; height: 1px; margin: 0px; overflow: hidden; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 0.057em;"></span></span><span class="mi" id="MathJax-Span-9" style="-webkit-transition: none; border: 0px; display: inline; font-family: MathJax_Main; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px;">%</span></span><span style="-webkit-transition: none; border: 0px; display: inline-block; height: 2.912em; margin: 0px; padding: 0px; position: static; transition: none; vertical-align: 0px; width: 0px;"></span></span></span><span style="-webkit-transition: none; border-left-style: solid; border-width: 0px 0px 0px 0.003em; display: inline-block; height: 1.253em; margin: 0px; overflow: hidden; padding: 0px; position: static; transition: none; vertical-align: -0.309em; width: 0px;"></span></span></nobr></span>.</li>
<li>In the paper a criteria of 90-96\% was used<figure class="grid1" role="group" style="text-align: center; vertical-align: top;"><div class="row" style="display: table-row; vertical-align: top;">
<br />
<figure class="image" role="group" style="display: table-cell; height: 120px; vertical-align: top; width: 320px;"><img height="120" src="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/repository/images/Image_110.png" width="160" /><figcaption class="caption1">Original</figcaption></figure><figure class="image" role="group" style="display: table-cell; height: 120px; vertical-align: top; width: 320px;"><img height="120" src="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/repository/images/Image_111.png" width="160" /><figcaption class="caption1">Global Threshold</figcaption></figure><figure class="image" role="group" style="display: table-cell; height: 120px; vertical-align: top; width: 320px;"><img height="120" src="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/repository/images/Image_112.png" width="160" /><figcaption class="caption1">new Threshold</figcaption></figure></div>
</figure></li>
<li>Without any additional information ,the criteria used for selection of lower and upper threholds ,simply is instrumental in removal of outliers.</li>
<li>In the figures shown ,some background pixels,pixels belonging to hair,lips etc are also shown as skin colored pixels.</li>
<li>Now let is consider pixels which belong to face,This in given manually by specifying a mask.Pixels in ROI (168,63,50,50) is explicitly specified as skin colored pixels.</li>
<li>A histogram is computed by considering only the pixels in ROI.</li>
<li>The global histogram and newly constructed histogram are combined by performing a weighted average.</li>
<li>Obviously the pixels in histogram computed over entire image are large than ones computed in small ROI,to avoid bias due to count of pixels used to build the histogram, the histograms are normalized between 0 to 1,before computing the linear combination.</li>
<li>Then we determine the pixels between which 90\% of pixels lie.</li>
<li>The hue range corresponding to this is (13,16)</li>
<li>The skin color detected considering the new range in shown in figure <a href="https://www.blogger.com/blogger.g?blogID=8650972056239106530#fig:image5">fig:image5</a><figure class="grid1" role="group" style="text-align: center; vertical-align: top;"><div class="row" style="display: table-row; vertical-align: top;">
<br />
<figure class="image" role="group" style="display: table-cell; height: 120px; vertical-align: top; width: 320px;"><img height="120" src="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/repository/images/Image_113.png" width="160" /><figcaption class="caption1">New threshold</figcaption></figure><figure class="image" role="group" style="display: table-cell; height: 120px; vertical-align: top; width: 320px;"><img height="120" src="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/repository/images/Image_114.png" width="160" /><figcaption class="caption1">Skin Image</figcaption></figure></div>
</figure></li>
<li>Thus incorporating the cue's about skin color,enhances the detection performane of skin colored pixels.</li>
<li>In the above example the cue has been encorporated manually,however if we can incorporate the cur automatically then we have make the process of skin color detection completely adaptive.</li>
<li>Some techniques suggested in the paper were based on using motion based cue like frame differencing and optical flow tracking.</li>
<li>These techniques are suitable for HCI application assuming the object of interest is in motion.</li>
<li>Frame differencing provides a simple method to determine the region which encountered motion and use these pixels .<h4>
Code</h4>
The code for the same can be found at OpenVision Repository <a href="https://github.com/pi19404/OpenVision">https://github.com/pi19404/OpenVision</a> The class AdaptiveSkinDetector encapsulates the methods for implementing the skin detector. The code for the same can be found in files <a href="https://www.blogger.com/ImgProc/adaptiveskindetector.cpp">ImgProc/adaptiveskindetector.cpp</a> <a href="https://www.blogger.com/IgmProc/adaptiveskindetector.hpp">IgmProc/adaptiveskindetector.hpp</a>. For histogram computation the class Histogram is used which can be found in the files<a href="https://www.blogger.com/ImgProc/Histogram.cpp">ImgProc/Histogram.cpp</a>,<a href="https://www.blogger.com/ImgProc/Histogram.hpp">ImgProc/Histogram.hpp</a><div class="syntaxhighlighter " id="highlighter_302774" style="background-color: rgb(255, 255, 255) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 1em 0px !important; min-height: inherit !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 1276.109375px;">
<div class="lines" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">1</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important;"><code class="preprocessor" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: gray !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">#include "ImgProc/adaptiveskindetector.hpp"</code></td></tr>
</tbody></table>
</div>
<div class="line alt2" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">2</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">...</code></td></tr>
</tbody></table>
</div>
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">3</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">AdaptiveSkinDetector ss1;</code></td></tr>
</tbody></table>
</div>
<div class="line alt2" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">4</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">...</code></td></tr>
</tbody></table>
</div>
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">5</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Mat hmask;</code></td></tr>
</tbody></table>
</div>
<div class="line alt2" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">6</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ss1.run(image,hmask);</code></td></tr>
</tbody></table>
</div>
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">7</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">...</code></td></tr>
</tbody></table>
</div>
</div>
</div>
</li>
</ul>
<b>References</b><br />
<br />
<ol>
<li>Farhad Dadgostar and Abdolhossein Sarrafzadeh. An Adaptive Real-time Skin Detector Based on Hue Thresholding: A Comparison on Two Motion Tracking Methods . In: Pattern Recogn. Lett. 27.12 (Sept. 2006), pp. 1342 1352. issn:0167-8655. doi: 10.1016/j.patrec.2006.01.007. url: http://dx.doi. org/10.1016/j.patrec.2006.01.007.</li>
</ol>
<br />
<div>
<br /></div>
<div>
The PDF version of the document can be found below</div>
<div style="-x-system-font: none; display: block; font-family: Helvetica,Arial,Sans-serif; font-size-adjust: none; font-size: 14px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; margin: 12px auto 6px auto;">
<a href="http://www.scribd.com/doc/219915143/Adaptive-Skin-Color-Detector" style="text-decoration: underline;" title="View Adaptive Skin Color Detector on Scribd">Adaptive Skin Color Detector</a> by <a href="http://www.scribd.com/pi19404" style="text-decoration: underline;" title="View pi194043's profile on Scribd">pi194043</a></div>
<iframe class="scribd_iframe_embed" data-aspect-ratio="0.708006279434851" data-auto-height="false" frameborder="0" height="600" id="doc_55864" scrolling="no" src="//www.scribd.com/embeds/219915143/content?start_page=1&view_mode=scroll&access_key=key-1a0iudowbs7824dh7e45&show_recommendations=true" width="100%"></iframe>pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-21946603663681664692014-04-24T01:25:00.001+05:302014-08-12T10:03:26.365+05:30Multi Class Logistic Regression Training and Testing<link href="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/common.css" rel="stylesheet" type="text/css"></link>
<br />
<h4>
Introduction</h4>
In this article we will look at training and testing of
a Multi-class Logistic Classifier
<br />
<ul>
<li> Logistic regression is a probabilistic, linear classifier. It is parametrized
by a weight matrix $W$ and a bias vector $b$. Classification is
done by projecting data points onto a set of hyperplanes, the distance to
which is used to determine a class membership probability.
</li>
<li> Mathematically this can be expressed as
\begin{eqnarray*}
& P(Y=i|x, W,b) =\frac {e^{W_i x + b_i}}{\sum_j e^{W_j x + b_j}} \\
\end{eqnarray*}
</li>
<li> Corresponding to each class $y_i$ logistic classifier is paramemterized
by a set of parameters $W_i,b_i$.
</li>
<li> These parameters are used to compute the class probability.
</li>
<li> Given a unknown vector x,The prediction is performed as
\begin{eqnarray*}
& y_{pred} = argmax_i P(Y=i|x,W,b) \\
& y_{pred} = argmax_i \frac {e^{W_i x + b_i}}{\sum_j e^{W_j x + b_j}}
\end{eqnarray*}
</li>
<li> Given a set of labelled training data ${X_i,Y_i}$ where $i\ in {1,\ldots,N}$
we need to estimate these parameters.
<h4>
Loss Function</h4>
</li>
<li> Ideally we would like to compute the parameters so that the $0-1$ loss is minimized
\begin{eqnarray*}
& \ell_{0,1} = \sum_{i=0}^{|\mathcal{D}|} I_{f(x^{(i)}) \neq y^{(i)}} \\
& f(x)= argmax_k P(Y=y_k |x,\theta)
\end{eqnarray*}
</li>
<li> $P(Y=y_k |x,\theta)$ is modelled using logistic function.
</li>
<li> The $0-1$ loss function is not differentiable ,hence optimizing
it for large modes is computationally infesible.
</li>
<li> Instead we maximize the log-likelyhood of the classifier given
the training data $\mathcal{D}$.
</li>
<li> Maximum Likelyhood estimation is used to perform this operation.
</li>
<li> Estimate the parameters so that likelyhood of training data $\mathcal{D} $
is maximized under the model parameters
</li>
<li> It is assumed that the data samples are independent ,so the probability
of the set is the product of probabilities of individual examples.
\begin{eqnarray*}
& L(\theta={W,b},\mathcal{D}) =argmax \prod_{i=1}^N P(Y=y_i | X=x_i,W,b) \\
& L(\theta,\mathcal{D}) = argmax \sum_{i=1}^N log P(Y=y_i | X=x_i,W,b) \\
& L(\theta,\mathcal{D}) = - argmin \sum_{i=1}^N log P(Y=y_i | X=x_i,W,b) \\
\end{eqnarray*}
</li>
<li> It should be noted that Likelyhood of correct class is not same as
number of right predictions.
</li>
<li> Log Likelyhood function can be considered as differential version of
the $0-1$ loss function.
</li>
<li> In the present application negative log-likelyhood is used as the loss function
</li>
<li> Optimal parameters are learned by minimizing the loss function.
</li>
<li> In the present application gradient based methods are used for minimization.
</li>
<li> Specifically stochastic gradient descent and conjugated gradient
descent are used for minimization of the loss function.
</li>
<li> The cost function is expressed as
\begin{eqnarray*}
& L(\theta,\mathcal{D}) = - \sum_{i=1}^N log P(Y=y_i | X=x_i,W,b) \\
& L(\theta,\mathcal{D}) = - \sum_{i=1}^N log \frac {e^{W_i x + b_i}}{\sum_j e^{W_j x + b_j}} \\
& L(\theta,\mathcal{D}) = - \sum_{i=1}^N log {e^{W_i x + b_i}}- log {\sum_j e^{W_j x + b_j}} \\
& L(\theta,\mathcal{D}) = - \sum_{i=1}^N {W_i x + b_i} + log \frac{1}{\sum_j e^{W_j x + b_j}} \\
\end{eqnarray*}
</li>
<li> The first part of the sum is affine,second is a log of sum of exponentials which is convex
Thus the loss function is convex.
</li>
<li> Thus we can compute the parameters corresponding to global maxima of the loss function
using gradient descent methods.
</li>
<li> Thus we compute the derivatives of the loss function $L(\theta,\mathcal{D})$
with respect to $\theta$,$\partial{\ell}/\partial{W}$ and $\partial{\ell}/\partial{b}$
<h4>
Theano</h4>
</li>
<li> Theano is a Python library that allows you to define, optimize,
and evaluate mathematical expressions involving multi-dimensional arrays efficiently.
</li>
<li> It is a expression compiler,and can evaluate symbolic expression
when executed.Typically programs which are implemented in C/C++ can be written
concisely and efficiently in Theano.
</li>
<li> computing the gradients in most programming languages (C/C++, Matlab, Python),
involves manually deriving the expressions for the gradient of the loss with respect to the parameters
$\partial{\ell}/\partial{W}$, and $\partial{\ell}/\partial{b}$,
</li>
<li> This approah not only involves manual coding but the derivatives
can get difficult to compute for complex models,
</li>
<li> With Theano, this work is greatly simplified as it performs automatic
differentiation .
<h4>
Example</h4>
</li>
<li> For demonstration,we will use MNIST dataset
The MNIST dataset consists of handwritten digit images and it is divided in 60,000 examples for
the training set and 10,000 examples for testing.
The official training set of 60,000 is divided into an actual training set of 50,000 examples
and 10,000 validation examples
All digit images have been size-normalized and centered in a fixed size image of 28 x 28 pixels.
In the original dataset each pixel of the image is represented by a value between 0 and 255, where 0 is black,
255 is white and anything in between is a different shade of grey.
</li>
<li> The dataset can be found at <a href="http://deeplearning.net/data/mnist/mnist.pkl.gz">http://deeplearning.net/data/mnist/mnist.pkl.gz</a>.
</li>
<li> The data set is pickled can be loaded using python pickle package.
</li>
<li> The data set consists of training,validation and test set.
</li>
<li> The data set consists of feature vector of length $28x28=784$
and number of classes are 10.
<figure class="grid1" role="group"><div class="row">
<br />
<figure class="image" role="group">
<img height="120" src="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/repository/images/mnist_0.png" width="160" />
<img height="120" src="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/repository/images/mnist_1.png" width="160" />
<img height="120" src="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/repository/images/mnist_2.png" width="160" />
</figure>
</div>
</figure>
</li>
<li> A class called Logistic Regression is defined which encapsulates
the methods that are used to perform training and testing of multi-class
Logistic Regression classifier.
<h4>
Theano Code</h4>
</li>
<li> The python code for training and testing can be found in the git repository
<a href="https://github.com/pi19404/OpenVision">https://github.com/pi19404/OpenVision</a> <a href="https://www.blogger.com/ImgML/LogisticRegression.py">ImgML/LogisticRegression.py</a> file.
</li>
<li> the <a href="https://www.blogger.com/ImgML/load_datasets.py">ImgML/load_datasets.py</a> contains methods to load datasets from
pickel files or SVM format files.
<script class="brush: python" type="syntaxhighlighter"> <![CDATA[
""" symbolic expressions defining input and output vectors"""
x=T.matrix('x');
y=T.ivector('y');
""" The mnist dataset in pickel format"""
model_name1="/media/LENOVO_/repo/mnist.pkl.gz"
""" creating object of class Logistic regression"""
""" input is 28*28 dimension feature vector ,and
output lables are digits from 0-9 """
classifier = LogisticRegression(x,y,28*28,10);
""" loading the datasets"""
[train,test,validate]=load_datasets.load_pickle_data(model_name1);
""" setting the dataset"""
classifier.set_datasets(train,test,validate);
#
#classifier.init_classifier(model_name1);n_out
""" Training the classifiers"""
classifier.train_classifier(0.13,1000,30);
""" Saving the model """
classifier.save('1');
#x=classifier.train[0].get_value(borrow=True)[0];
#classifier.predict(x);
""" Loading the model"""
classifier.load('1')
x=train[0].get_value(borrow=True);
y=train[1].eval();
print 'True class:'+`y`
xx,yy=classifier.predict(x);
print 'Predicted class:' + `yy`
classifier.testing();
</script>
</li>
<li> C/C++ code has been also written using Eigen/OpenCV and incorporated in OpenVision Library.
This can be found in the files <a href="https://github.com/pi19404/OpenVision">https://github.com/pi19404/OpenVision</a> <a href="https://www.blogger.com/ImgML/LogisticRegression.cpp">ImgML/LogisticRegression.cpp</a>
and <a href="https://www.blogger.com/ImgML/LogisticRegression.hpp">ImgML/LogisticRegression.hpp</a> files.
</li>
</ul>
<div>
<br /></div>
<div style="-x-system-font: none; display: block; font-family: Helvetica,Arial,Sans-serif; font-size-adjust: none; font-size: 14px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; margin: 12px auto 6px auto;">
The PDF Version of the document can be found below</div>
<div style="-x-system-font: none; display: block; font-family: Helvetica,Arial,Sans-serif; font-size-adjust: none; font-size: 14px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; margin: 12px auto 6px auto;">
<a href="http://www.scribd.com/doc/215530741/Multi-Class-Logistic-Regression-Training-and-Testing" style="text-decoration: underline;" title="View Multi Class Logistic Regression Training and Testing on Scribd">Multi Class Logistic Regression Training and Testing</a> by <a href="http://www.scribd.com/pi19404" style="text-decoration: underline;" title="View pi194043's profile on Scribd">pi194043</a></div>
<iframe class="scribd_iframe_embed" data-aspect-ratio="0.708006279434851" data-auto-height="false" frameborder="0" height="600" id="doc_90609" scrolling="no" src="//www.scribd.com/embeds/215530741/content?start_page=1&view_mode=scroll&access_key=key-1kob6xuqz2dgjtz76t29&show_recommendations=true" width="100%"></iframe>
<br />
<div>
<br /></div>
<div>
<br /></div>
pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-45304219514572938572014-04-24T01:24:00.001+05:302014-08-12T10:15:40.069+05:30ARM Neon Optimization for image interleaving and deinterleaving<h1>
<div class="allcaps">
ARM Neon Optimization InterLeaving/De-Interleaving</div>
</h1>
<ul>
<h4>
Introduction</h4>
<li>
In this article we will look at basic interleaving and de-interleaving operations
using ARM Neon optimization and evaluate the performance improvements on android
based mobile device in comparison with standard opencv code
<h4>
ARM Neon</h4>
</li>
<li>
ARM's NEON technology is a 64/128-bit hybrid SIMD architecture designed to accelerate
the performance of a piece of code.
</li>
<li>
SIMD technology allows process multiple data with one instruction call, saving time for other computations
A set of pixels will be processed at a time.
</li>
<li> One way to achieve this is to write assembly code ,which requires a steep learning curve
and requires knowledge of processor architecture,instruction set etc.
</li>
<li> Instead of using low-level instructions directly.
There are special functions, called intrinsic, which can be treated as regular functions but they works with input
data simultaneously.
<h4>
Deinterleaving and Interleaving channels of Image</h4>
</li>
<li> NEON structure loads read data from memory into 64-bit NEON registers, with optional deinterleaving.
Stores work similarly, reinterleaving data from registers before writing it to memory.
</li>
<li> A set of neon intrinsic instruction set are provided for deinterleaving data.
</li>
<li> The simultaneously pull data from the memory and seperate the data into different registers
This is called deinterleaving .
</li>
<li> The Neon structure loads the data from the memory into 64 bit neon registers with optional
interleaving.
</li>
<li> The opencv funtions split and merge are ported to arm neon and performance
comparision with opencv code is performed.
</li>
<li> Data loads interleaves elements based on the size specified in the instruction .
<h4>
De-InterLeaving</h4>
</li>
<li> The de-interleave seperates the pairs of adjacenet elements in the memory into seperate registers.
</li>
<li> the VLD3 instruction seperates/de-interleaves the BGR channels of the image and sperates them into 3
different registers.The BGR values are stored in adjacent memory locations.
</li>
<li> The result of vld instruction is then stored to registers which point to destination memory location
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
vld3_u8
/*This instruction loads the contents of memory location
with interleaving of adjacent memory locations .This results
in 8 elements of memory being loaded into single 64 bit register
and we have 3 such registers as a result of interleaving process.
This may be used when the pointer refers to data of type 8 bit
signed or unsigned integers
*/
vst1_u8
//This instruction is used to store contents of 64 bit register
to desired memory location.8 simultaneous elements (8x8 =64) constituting
the 64 bit register are written to the memory location.
void neon_interlace(uint8_t * __restrict d3,uint8_t * __restrict r0,uint8_t * __restrict r1,uint8_t * __restrict r2,int width,int height)
{
int i;
uint8_t *s3 = (uint8_t *)d3;
for(i=0;i<(width*height)/8;i++)
{
uint8x8x3_t loaded = vld3_u8(s3);
vst1_u8(r0,loaded.val[0]);
vst1_u8(r1,loaded.val[1]);
vst1_u8(r2,loaded.val[2]);
s3=s3+3*8;
r0=r0+8;
r1=r1+8;
r2=r2+8;
}
}
</script>
<h4>
NDK BUILD</h4>
</li>
<li> Since the application is being developed for android applications,the android NDK toolchain
is used for cross compilation.
</li>
<li> ndk-build utility is used to build the application.
</li>
<li> The ndk-build utility requires that based build directory contain a directory called \textbf{jni}
</li>
<li> The jni directory contains all the source files as well as \textbf{Android.mk,Application.mk}
which are the makefile for build process.
</li>
<li> In the present application the jni directory contains the files \textbf{neon.cpp,helloneon-intrinsics.c,helloneon-intrinsics.h}
source files.
</li>
<li> To initiated the build process in verbose mode execute the command
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
ndk-build V=1 all
</script>
</li>
<li> This generates the helloneon binary in the \textbf{libs/armeabi-v7a} directory
</li>
<li> The directory is transferred to the directory
\textbf{/data/tmp/local/NEON_TEST} on android mobile device
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
adb push libs/armeabi-v7a/helloneon /data/local/tmp/NEON_TEST
</script>
</li>
<li> The \textbf{/data/tmp/local} directory and files created under this directory can
contains files with execute permission.I could not find any other sud-directory under
the file system which provided execute permission for binaries or ability to provide
execute permissions for binaries.
</li>
<li> The script a.ksh being called below exports basic variables
and then executes the binary.
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
cd /data/local/tmp/NEON_TEST
./helloneon
adb shell /data/local/tmp/NEON_TESST/a.ksh
</script>
</li>
<li> The performance of neon intrinsic function is compared with standard opencv split function
<br />
OPENCV : 15ms <br />
NEON : 11ms <br />
</li>
<li> There is not a very significant improvement seen due to neon optimization.
</li>
<li> As per many references and by viewing the disassembly output of
the compiler it can be seen that the main reason was found that the arm compiler is not able to generate
optimized assembly code .
</li>
<li> The compiler generates heavily unoptimized code that results in larger number of cycles
than required.
</li>
<li> The compilation commands were taken from the ndk-build verbose build output
and the -c flag was replaced with -s to generate the assembly code
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
/opt/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/
linux-x86/bin/arm-linux-androideabi-gcc -MMD -MP -MF /home/pi19404/
ARM//obj/local/armeabi-v7a/objs/helloneon/helloneon-intrinsics.o.d
-fpic -ffunction-sections -funwind-tables -fstack-protector
-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__
-Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -Os
-fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -mfpu=neon
-I/usr/local/include -I/media/UBUNTU/repository/OpenVisionLibrary/OpenVision/
-I/opt/android-ndk-r7/sources//android/cpufeatures
-I/opt/android-ndk-r7/sources/cxx-stl/gnu-libstdc++/include
-I/opt/android-ndk-r7/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include
-I/home/pi19404/ARM//jni -DANDROID -DHAVE_NEON -fPIC -DANDROID
-I/usr/local/include/opencv -I/usr/local/include -I/OpenVision
-I/media/UBUNTU/repository/OpenVisionLibrary/OpenVision -fPIC
-DHAVE_NEON=1 -ftree-vectorize -mfpu=neon -O3 -mfloat-abi=softfp
-ffast-math -Wa,--noexecstack -O3 -DNDEBUG
-I/opt/android-ndk-r7/platforms/android-8/arch-arm/usr/include
/home/pi19404/ARM//jni/helloneon-intrinsics.c -S
</script>
</li>
<li> The above command will generate the the file \textbf{helloneon-intrinsics.s} in the present directory
</li>
<li> A lot of unecessary instruction can be observed in the assembly code.
</li>
<li> The assembly level code corresponding to the functions were optimized and compiled
</li>
<li> For compilation again the debug build output observed from ndk-build process as
modified so that \textbf{helloneon-intrinsics.o} object file is compiled from \textbf{helloneon-intrinsics.s}
and helloneon binary file is compiled and linked from all source files.
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
/opt/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc \
-MMD -MP -MF \
-fpic -ffunction-sections -funwind-tables -fstack-protector\
-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \
-Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -Os -fomit-frame-pointer \
-fno-strict-aliasing -finline-limit=64 -mfpu=neon -I/usr/local/include \
-I/media/UBUNTU/repository/OpenVisionLibrary/OpenVision/
-I/opt/android-ndk-r7/sources//android/cpufeatures
-I/opt/android-ndk-r7/sources/cxx-stl/gnu-libstdc++/include
-I/opt/android-ndk-r7/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include \
-I/home/pi19404/ARM//jni -DANDROID -DHAVE_NEON -fPIC -DANDROID
-I/usr/local/include/opencv -I/usr/local/include -I/OpenVision \
-I/media/UBUNTU/repository/OpenVisionLibrary/OpenVision -fPIC
-DHAVE_NEON=1 -ftree-vectorize -mfpu=neon -O3 -mfloat-abi=softfp
-ffast-math -Wa,--noexecstack -O3 -DNDEBUG
-I/opt/android-ndk-r7/platforms/android-8/arch-arm/usr/include
-c /home/pi19404/ARM/jni/helloneon-intrinsics.s \
-o /home/pi19404/ARM/obj/local/armeabi-v7a/objs/helloneon/helloneon-intrinsics.o
--sysroot=/opt/android-ndk-r7/platforms/android-14/arch-arm/
/opt/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/
prebuilt/linux-x86/bin/arm-linux-androideabi-g++ -Wl,--gc-sections
-Wl,-z,nocopyreloc --sysroot=/opt/android-ndk-r7/platforms/android-8/arch-arm
/home/pi19404/ARM//obj/local/armeabi-v7a/objs/helloneon/neon.o
/home/pi19404/ARM//obj/local/armeabi-v7a/objs/helloneon/helloneon-intrinsics.o
/home/pi19404/ARM//obj/local/armeabi-v7a/libcpufeatures.a
/home/pi19404/ARM//obj/local/armeabi-v7a/libgnustl_static.a
/opt/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/
prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
-Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack
-L/opt/android-ndk-r7/platforms/android-8/arch-arm/usr/lib -fPIC -llog
-ldl -lm -lz -lm -lc -lgcc -Wl,-rpath,'libs/armeabi-v7a'
-L/home/pi19404/ARM//jni/../libs/armeabi -llog -Llibs/armebi -Llibs/armeabi-v7a
-lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_flann
-lc -lm -o /home/pi19404/ARM//obj/local/armeabi-v7a/helloneon
cp /home/pi19404/ARM//obj/local/armeabi-v7a/helloneon libs/armeabi-v7a
</script>
</li>
<li> The results of the optimization process is as follows <br />
OPENCV : 15ms <br />
NEON : 8ms <br />
NEON OPTIMIZED : 6 ms <br />
</li>
<li> Thus a speedup factor of 1.4 and total performance improvement of 2.5x was observed.
</li>
<li> Thus it can be seen that atleast 2.5x improvement is observed after optimizing the assembly code.
</li>
<li> This still does not motivate the use of assembly level coding since the developement effort
may outweight the optimization benifits.
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
push {r4, r5, r6, r7, r8, r9, sl, fp}
@store registers on stack
.save {r4, r5, r6, r7, r8, r9, sl, fp}
.LCFI0:
.pad #64
sub sp, sp, #64 @pointer to top of stack
.LCFI1:
mov r7, r0
ldr r4, [sp, #96] @load function arguments r4 64+8*4
ldr r5, [sp, #100] @load function arguments r5 64+9*4
mul r6,r4,r5
asr r6, r6, #3 @divide loop count by 8
.loop:
# load 8 pixels:
vld3.8 {d0-d2},[r7] @load pixels
vst1.8 {d0}, [r1] @store interleaved pixels
vst1.8 {d1}, [r2]
vst1.8 {d2}, [r3]
adds r7, r7, #24 @increment counter
adds r1, r1, #8
adds r3, r2, #8
adds r3, r3, #8
subs r6, r6, #1 @check loop counter
bne .loop
add sp, sp, #64
pop {r4, r5, r6, r7, r8, r9, sl, fp}
bx lr
</script>
<h4>
InterLeaving</h4>
</li>
<li> The interleaving operation corresponds to combining 3 independent channels
of a image into multi-channel image.
</li>
<li> Each element of idependent channels are stored in adjacent locations
in the multi-channel image.
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
void neon_interleave(uint8_t * __restrict d3,uint8_t * __restrict r0,uint8_t * __restrict r1,uint8_t * __restrict r2,int width,int height)
{
int i;
uint8x8x3_t v;
for(i=0;i<width*height/8;i++)
{
v.val[0]=vld1_u8(r0);
v.val[1]=vld1_u8(r1);
v.val[2]=vld1_u8(r2);
vst3_u8(d3,v);
d3=d3+3*8;
r0=r0+8;
r1=r1+8;
r2=r2+8;
}
}
</script>
</li>
<li> The performance is as follows : <br />
OPENCV : 9ms <br />
NEON OPTIMIZED : 3 ms <br />
</li>
<li> The interleaving process shows a performance improvement of about 3x.
</li>
<li> Thus by using neon intrinsics we can achieve performance improvements wrt standard C code
and by optimizing the assembly code further performance benifits can be achived.
</li>
<li> It is to be noted that OPENCV code is compiled with SSE optimization which may also be in play
hence the actual code speedup may be higher.
</li>
<li> However a large speedup was not observed in the interleaving and de-interleaving operation
due to optimizing the assembly code .
<h4>
Code</h4>
</li>
<li> The code for the same can be found in the git repository <a href="https://github.com/pi19404/OpenVision">https://github.com/pi19404/OpenVision</a>
in the POC/ARM subdirectory.
</li>
<li> The jni subdirectory consists of the source files as well as the make files.
</li>
<li> The files \textbf{generate_assembly.ksh} generate the helloneon-intrinsis.s files
in the ARM directory.After modifying the file copy it to the jni sub-directory,
</li>
<li> \textbf{compile_assembly.ksh} compiles the helloneon-intrinsis.s and also the binary file
</li>
<li> The binary requires the opencv library files which needs to be transferred to the android mobile device
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
adb push libs/armeabi-v7a/ /data/local/tmp/NEON_TEST
</script>
</li>
<li>
The link <a href="http://pulsar.webshaker.net/ccc/result.php">Execution Cycle computation :</a>
shows the number of execution cycles taken by ARM assembly code ,which can be used to check the performance of compiler generated and optimized
code.
</li>
</ul>
<div>
<b>The PDF version of the document can be found below</b></div>
<div style="-x-system-font: none; display: block; font-family: Helvetica,Arial,Sans-serif; font-size-adjust: none; font-size: 14px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; margin: 12px auto 6px auto;">
<a href="http://www.scribd.com/doc/211500572/ARM-Neon-Optimization-for-image-interleaving-and-deinterleaving" style="text-decoration: underline;" title="View ARM Neon Optimization for image interleaving and deinterleaving on Scribd">ARM Neon Optimization for image interleaving and deinterleaving</a> by <a href="http://www.scribd.com/pi19404" style="text-decoration: underline;" title="View pi194043's profile on Scribd">pi194043</a></div>
<iframe class="scribd_iframe_embed" data-aspect-ratio="0.708006279434851" data-auto-height="false" frameborder="0" height="600" id="doc_84809" scrolling="no" src="//www.scribd.com/embeds/211500572/content?start_page=1&view_mode=scroll&access_key=key-1a297580korifnxvyfgz&show_recommendations=true" width="100%"></iframe>pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-27990829652649056292014-04-24T01:23:00.001+05:302014-08-12T10:31:19.548+05:30Dense Optical Flow Expansion Based On Polynomial Basis Approximation<h1><p class="allcaps">Dense Motion Estimation based on Polynomial expansion
<p>
</h1>
<h4>Introduction</h4>
In this article we will look at dense motion estimation based on polymonial repsentation
of image.The polynomial basis representation of the image is obtained by approximating
the local neighborhood of image using quadratic polynomial basis.The displacement
between adjacent frames can be obtained by equating the coefficients of the basis.
<h4>Introduction</h4>
<ul>
<li> This article describes a fast dense optical flow computation
algorithm by [4] . In the earlier articles it was seen
that a local neighborhood of image can be represented using polynomial basis.
Using this representation estimation of dense optical flow is obtained
at each point in the image.
<br></br>
<figure role="group" class="grid1"><div class="row"><figure role="group" class="image">
<img width=160 height=120 src="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/repository/images/poly3.png" >
<figcaption class="caption1">2D basis function</figcaption>
</figure>
</div><div class="row"></div><figcaption class="caption1">Polynomial basis</figcaption>
</figure>
<li> Assuming how a polynomial transforms under translation using the polynomial
expansion coefficients derived from current and previous frames and
estimate of displacement vector is obtained.
<li>
The idea of polynomial expansion is to approximate a neighborhood of a point
in a 2D function with a polynomial.Considering quadratic polynomial basis $1,x^2,y^2,x,y,xy$,pixel values in a neighborhood
of image is represented by
\[
f(x) ~ x^T A x + b^T x + c
\]
where A is a symmetric matrix,b is a vector and c is a scalar
<li>
The coefficients can be estimated by weighted least square estimate of pixel
values about neighborhood as seen in the earlier article.
As with all optical flow algorithm,the brightness constancy assumption is made.
The brighness of a path of image in adjacent frames is constant.
<li>
Consider a translational motion $\mathbf{d}$ ecountered at point $\mathbf{(x,y)}$ in the image.
\begin{eqnarray*}
\hline
\\
& f_1(x) = x^T A_1 x + b_{1}^Tx +c_1 \\
& f_2(x) = f_1(x-d) = (x-d)^T A_1 (x-d) + b_{1}^T(x-d) +c_1 \\
& f_2(x) = f_1(x-d) = (x)^T A_1 (x) + (b_{1}-2A_1d)^T(x) \\
& + d^TAd-b_1^Td+c_1 \\
& f_2(x) = f_1(x-d) = (x)^T A_1 (x) + b_2^T(x) + c_2 \\
& equating coefficients in the two polynomials \\
& Due to brightness constancy assumption \\
& A_2 = A_1 \\
& b_2=(b_{1}-2A_1d) \\
& c_2=d^TAd-b_1^Td+c_1 \\
& Assuming $A$ is non-singular \\
& d=-\frac{1}{2}A^-1(b_2-b_1)
\\
\hline
\end{eqnarray*}
Thus by equating the coefficients of the polynomial the displacement vector
can be obtained at each point in the image assuming there is overlap
between the region of interest ie image neighborhood in adjacent frames.
<li>
Let us say we have the estimate of displacement $\bar{d}$
We extract the ROI about the neighborhood at point $P(x,y)$ and point $P(x+d.x,y+d.y)$
The polynomial basis are extracted and the computation that is shown above is performed.
<li>
The total displacement can be estimated as
\begin{eqnarray*}
\hline
\\
&\bar{b}_2=b_{1}-2A_1 (\bar{d}) \\
& \text { we know $\bar{d}$,$A_1$,$b_1$} \\
& d = -0.5*A^{-1} (b_2+\bar{b}_2 - b_1)
\\
\hline
\end{eqnarray*}
<li>
Thus an iterative scheme can be used where in every successive iteration a better estimate of
displacement vector is obtained.The iterations can be terminated when change is displacement
vector is below is threshold in successive iterations or specific number of iterations have been completed.
The intial estimate of displacement vector is assumed to be $\mathbf{(0,0)}$
Thus ROI or the image patch in the current and previous frames are at the same.
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
/**
* @brief updatePoly : The function computes the optical flow displacement vector
* @param ptr1 : pointer to array containing the polynomial basis components
* @param ptr2 : pointer to array containing the polynomial basis components
* @param d : estimate of displacement vector at the current point
* @param flag : the flag indicating if the point is border pixels or not
* @param M : pointer to output array returning the computed coefficients
* @param x : co-ordinate at the current point where the coefficients is evaluated
* @param y :
* @param s : windows size for averaging
*/
void updatePoly(const float *ptr1,const float *ptr2,Point2f d,bool flag,
float *M,Point p,Size s)
{
int x=p.x;
int y=p.y;
const int BORDER = 5;
static const float border[BORDER] = {0.14f, 0.14f, 0.4472f, 0.4472f, 0.4472f};
float r[5];
float r2,r3,r4,r5,r6;
if(flag==true)
{
//average A_1 and A_2
r4=(ptr1[2]+ptr2[2])*0.5;
r5=(ptr1[3]+ptr2[3])*0.5;
r6=(ptr1[4]+ptr2[4])*0.25;
}
else
{
r[0]=0.f;
r[1]=0.f;
r[2]=ptr1[2];
r[3]=ptr1[3];
r[4]=ptr1[4]*0.5;
r2=r[0];
r3=r[1];
r4=r[2];
r5=r[3];
r6=ptr1[4]*0.5;
}
//computing -(b1-b2)
r2=(ptr1[0]-ptr2[0])*0.5;
r3=(ptr1[1]-ptr2[1])*0.5;
//sum for iterative estimation b2=b2+\bar{b2}
//r2 += r4*d.y + r6*d.x;
///r3 += r6*d.y + r5*d.x;
r2 += r4*d.x + r6*d.y;
r3 += r6*d.x + r5*d.y;
if( (unsigned)(x - BORDER) >= (unsigned)(s.width - BORDER*2) ||
(unsigned)(y - BORDER) >= (unsigned)(s.height - BORDER*2))
{
float scale = (x < BORDER ? border[x] : 1.f)*
(x >= s.width - BORDER ? border[s.width - x - 1] : 1.f)*
(y < BORDER ? border[y] : 1.f)*
(y >= s.height - BORDER ? border[s.height - y - 1] : 1.f);
r2 *= scale; r3 *= scale; r4 *= scale;
r5 *= scale; r6 *= scale;
}
//computing final displacement d=A^-1(b2-b1)*0.5
M[0] = r4*r4 + r6*r6; // G(1,1)
M[1] = (r4 + r5)*r6; // G(1,2)=G(2,1)
M[2] = r5*r5 + r6*r6; // G(2,2)
M[3] = r4*r2 + r6*r3; // h(1)
M[4] = r6*r2 + r5*r3; // h(2)
}
</script>
<li>
The method $\textbf{EstimateFlow}$ computes the coefficients $A,b_2,b_1$
required for displacentt field computation.The $\textbf{EstimateFlow}$ functions
call the method $\textbf{UpdatePoly}$ for each pixel in the image.
<li>
The displacement field obtained may be discontinuous and contain noise
and other atrifacts.Since it is reasonable to assume that if motion is encounted at a point,
the neighborhood pixels also encounter the same motion.
The displacement vector can be averaged over a neighborhood to get a better estimate
of the displacement field.
<li>
The method $\textbf{AverageFlow}$ computes the average of coefficients $A_1,b_2,b_1$
and then computes the displacement flow field.
\\
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
/**
* @brief AverageFlow
* @param _R0 : Polynomial basis of prev frame
* @param _R1 : Polynomial basis coefficients of current frame
* @param _flow :estimate of current displacement field
* @param matM :containing coefficients of polynomial basis for computing displacemnt field
*/
void AverageFlow( const Mat& _R0, const Mat& _R1,Mat& _flow, Mat& matM)
{
int x, y, i, width = _flow.cols, height = _flow.rows;
//computing the average flow field
cv::GaussianBlur(matM,matM,Size(15,15),sigma);
for( y = 0; y < height; y++ )
{
double g11, g12, g22, h1, h2;
float* flow = (float*)(_flow.data + _flow.step*y);
float *coeff=(float *)(matM.data+matM.step*y);
// update borders
for( x = 0; x < width; x++ )
{
g11 = coeff[x*5];
g12 = coeff[x*5+1];
g22 = coeff[x*5+2];
h1 = coeff[x*5+3];
h2 = coeff[x*5+4];
//computing determinant for inverse
double idet = 1./(g11*g22 - g12*g12 + 1e-3);
//computing displacement flow field
flow[x*2] = (float)((g11*h2-g12*h1)*idet);
flow[x*2+1] = (float)((g22*h1-g12*h2)*idet);
}
}
//calling EstimateFlow for updading coefficients
//for computation of next iteration
EstimateFlow(_R0, _R1, _flow, matM,0,flow.rows);
}
</script>
<li> This approach may in case of large displaement.Hence a multi scale estimation is performed.
The estimation of flow field is performed as the smallest resolution.The displacement computed
at the lower resolution is used as estimate for peform displacement
field computation at higher resolution.
<li>
Dense optial flow computed for two frames is shown in figure <a href="#2b">2b</a>
<figure role="group" class="grid1"><div class="row">\setcounter{subfigure}{0}
<figure role="group" class="image"> <img width=160 height=120 src="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/repository/images/dflowf1.png" >
<figcaption class="caption1">Frame 1</figcaption>
</figure>
<figure role="group" class="image"> <img width=160 height=120 src="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/repository/images/dflowf2.png" >
<figcaption class="caption1">Frame 2</figcaption>
</figure>
<figure role="group" class="image"> <img width=160 height=120 src="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/repository/images/dflow1.png" >
<figcaption class="caption1">Optical Flow</figcaption>
</figure>
</div><div class="row"></div><figcaption class="caption1">Displacement field</figcaption>
</figure>
<link href="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/common.css" rel="stylesheet" type="text/css"/>
<h4>Conclusion</h4>
This article describes the theory and implementation details of the dense optical flow
algorithm based on paper by [4].This code for the algorithm
can be found at github repository <a href=https://github.com/pi19404/OpenVision>https://github.com/pi19404/OpenVision</a>
in files DenseOf.cpp and DenseOf.hpp files.
In the future article we will look at optimizing the code using SSE,NEOM and OpenCL
optimizations to enable real time computation of the dense optical flow fields
</ul>
<div style="-x-system-font: none; display: block; font-family: Helvetica,Arial,Sans-serif; font-size-adjust: none; font-size: 14px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; margin: 12px auto 6px auto;">
<br /></div>
<div style="-x-system-font: none; display: block; font-family: Helvetica,Arial,Sans-serif; font-size-adjust: none; font-size: 14px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; margin: 12px auto 6px auto;">
<br /></div>
<div style="display: block; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: normal; margin: 12px auto 6px;">
<b>References</b></div>
<div style="margin: 12px auto 6px;">
</div>
<ol>
<li><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;">Kenneth Andersson and Hans Knutsson. Continuous normalized convolution. </span><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;">In: ICME (1). IEEE, 2002, pp. 725 728.</span><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;"> isbn:</span><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;"> 0-7803-7304-9.</span><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;"> url: http://</span><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;">dblp.uni-trier.de/db/conf/icmcs/icme2002-1.html</span></li>
<li><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;">Kenneth Andersson, Carl-Fredrik Westin, and Hans Knutsson. Prediction from </span><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;">o -grid samples using continuous normalized convolution. In: Signal Processing </span><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;">87.3 (Mar. 22, 2007), pp. 353 365.</span><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;"> url: http://dblp.uni- trier.de/db/</span><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;">journals/sigpro/sigpro87.html</span></li>
<li><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;">Gunnar Farnebäck. Motion-based Segmentation of Image Sequences . LiTH-ISY-</span><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;">EX-1596. MA thesis. SE-581 83 Linköping, Sweden: Linköping University, 1996.</span></li>
<li><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;">Gunnar Farnebäck. Polynomial Expansion for Orientation and Motion Estima</span><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;">tion . Dissertation No 790, ISBN 91-7373-475-6. PhD thesis. SE-581 83 Linköping,</span><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;">Sweden: Linköping University, Sweden, 2002.</span></li>
<li><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;">Gunnar Farneback. Two-Frame Motion Estimation Based on Polynomial Expan-</span><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px;">sion . In: SCIA. LNCS 2749. Gothenburg, Sweden, 2003, pp. 363 370.</span></li>
</ol>
<br />
<div>
<br /></div>
<div style="-x-system-font: none; display: block; font-family: Helvetica,Arial,Sans-serif; font-size-adjust: none; font-size: 14px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; margin: 12px auto 6px auto;">
<br /></div>
<div style="-x-system-font: none; display: block; font-family: Helvetica,Arial,Sans-serif; font-size-adjust: none; font-size: 14px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; margin: 12px auto 6px auto;">
<br /></div>
<div style="-x-system-font: none; display: block; font-family: Helvetica,Arial,Sans-serif; font-size-adjust: none; font-size: 14px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; margin: 12px auto 6px auto;">
<a href="http://www.scribd.com/doc/210750997/Dense-optical-flow-expansion-based-on-polynomial-basis-approximation" style="text-decoration: underline;" title="View Dense optical flow expansion based on polynomial basis approximation on Scribd">Dense optical flow expansion based on polynomial basis approximation</a> by <a href="http://www.scribd.com/pi19404" style="text-decoration: underline;" title="View pi194043's profile on Scribd">pi194043</a></div>
<iframe class="scribd_iframe_embed" data-aspect-ratio="0.708006279434851" data-auto-height="false" frameborder="0" height="600" id="doc_14079" scrolling="no" src="//www.scribd.com/embeds/210750997/content?start_page=1&view_mode=scroll&access_key=key-2a6845xnkhkk8naxnxfq&show_recommendations=true" width="100%"></iframe>pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-24529703917735786572014-04-24T01:21:00.001+05:302014-08-12T12:04:35.825+05:30OpenVision Library Gaussian Mixture Model Implementation<link href="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/common.css" rel="stylesheet" type="text/css"></link>
<h1>
<div class="allcaps">
OpenVision Library Gaussian Mixture Implementation
</div>
</h1>
<h4>
Introduction</h4>
<ul>
<li> In this article we will look at gaussian mixture model.
</li>
<li> Mixture Models are a type of density model which comprise a number of component functions, usually Gaussian.
</li>
<li> These component functions are combined to provide a multimodal density.
</li>
<li> GMM is a weighted average of gaussians where gaussian by its own mean can covariance matrix matrix
</li>
<li> The mixture density is given by
\begin{eqnarray*}
& P(X|\mu,\Sigma,w) = \sum_k w_k \mathcal{N}(X,\mu_k,\Sigma_k)
\end{eqnarray*}
</li>
<li> To compute the likelyhood that a random variable is sampled from the mixture model
we just need to compute the probability of individual gaussian component and then
find the weighted average.
</li>
<li> Instead of probability we can compute the log likelyhood of gaussian components
which would simply be the log of sum of weighted exponentials.
\begin{eqnarray*}
& L(X|\mu,\Sigma,w) = log \sum_k exp (log w_k +log \mathcal{N}(X,\mu_k,\Sigma_k) )
\end{eqnarray*}
</li>
<li> A gaussian mixture model is characterized by
<ul>
<li> Number of mixture components
</li>
<li> Weights of mixtures
</li>
<li> Mean and covariances of individual mixture components
</li>
</ul>
</li>
<li> Thus given the model parameters computation of probability that a vector
is sampled from the gaussian mixture model is fairly simple
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
vector<gaussian> components;
/**
* @brief ProbMix:method returns the probability that
* vector X belongs to each of mixture gaussian
* @param X : input vector X
* @return :output vector of probabilities
*/
vector<float> ProbMix(Mat X)
{
vector<float> res;
res.resize(_nmix);
for(int i=0;i<_nmix;i++)
{
// cerr << _weights[i] << endl;
res[i]=(_components[i].Prob(X));
}
return res;
}
/**
* @brief Prob : method computes the probability that vector X
* is drawn from the gaussian mixture model
* @param X : input vector X
* @return
*/
float Prob(Mat X)
{
float res=0;
for(int i=0;i<_nmix;i++)
{
// cerr << _weights[i] << endl;
res=res+_weights[i]*(_components[i].Prob(X));
}
return res;
}
</script>
</li>
<li> For example if we consider the following mixture models
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
MU1 = [1 2];
SIGMA1 = [2 0; 0 .5];
MU2 = [-3 -5];
SIGMA2 = [1 0; 0 1];
priors=[0.4 0.6];
X=[1.1 2.3];
</script>
</li>
<li> The probability that vector X belongs to GMM is computed as $0.0580374$ using the method Prob
</li>
<li> The probability that vector X belongs to individual mixture components is computed as $0.145093:9.5455e-17$
</li>
<li> Both the above results can be verified by manual calculation or other packages etc.
<h4>
Code</h4>
</li>
<li> The code for the same can be found in OpenVision git repository <a href="https://github.com/pi19404/OpenVision">https://github.com/pi19404/OpenVision</a>
in files <b>ImgMl/gaussianmixture.cpp</b> and <b>ImgMl/gaussianmixture.hpp</b> files.
</li>
<li> OpenVision is attempt at a opensource C/C++ Library developed in C/C++ using OpenCV,Eigen etc providing modular interface
for image processing,computer vision,machine learning applications.
</li>
</ul>
<div style="display: block; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: normal; margin: 12px auto 6px;">
<b>The PDF Version of the document can be found below</b><br />
<div style="font-weight: normal;">
<br /></div>
<div style="font-weight: normal;">
<a href="http://www.scribd.com/doc/210065713/OpenVision-Library-Gaussian-Mixture-Model-Implementation" style="text-decoration: underline;" title="View OpenVision Library Gaussian Mixture Model Implementation on Scribd">OpenVision Library Gaussian Mixture Model Implementation</a> by <a href="http://www.scribd.com/pi19404" style="text-decoration: underline;" title="View pi194043's profile on Scribd">pi194043</a></div>
</div>
<iframe class="scribd_iframe_embed" data-aspect-ratio="0.708006279434851" data-auto-height="false" frameborder="0" height="600" id="doc_33389" scrolling="no" src="//www.scribd.com/embeds/210065713/content?start_page=1&view_mode=scroll&access_key=key-2dx6ctw9a3dgfwvb7ax9&show_recommendations=true" width="100%"></iframe>pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-20359194938876035192014-04-24T01:19:00.002+05:302014-08-12T12:10:50.968+05:30Implementation of Discrete Hidden Markov Model for Sequence Classification in C++ using Eigen<h1>
<div class="allcaps">
Discrete Hidden Markov Models for Sequence Classification
</div>
</h1>
<h4>
Introduction</h4>
In this article we will look at hidden Markov models and its application
in classification of discrete sequential data.
<br />
<ul>
<li> Markov processes are examples of stochastic processes that generate random sequences of outcomes or
states according to certain probabilities.
</li>
<li> Markov chains can be considered mathematical descriptions of Markov models with a discrete set of states.
</li>
<li> In Markov chain the observed variables are states ,now we will consider the case that
the observed symbol is not directly the states but some random variable related to the underlying state
sequence.
</li>
<li> The true state of the system is latent and unobserved.
<h4>
Hidden Latent Variables</h4>
</li>
<li> Let $\mathcal{Y}$ denote a sequence of random variables taking the values in a euclidean space
$\mathcal{0}$
</li>
<li> A simplistic model is where each observation state is associated with a single
hidden state,Each hidden state emits a unique observation symbol.
\\
In this case if we know exactly if a observed variable corresponds
to a hidden state then the problem reduces to Markov chain.
\\
</li>
<li> However it may happen that observed state corresponds to more than
one hidden state with certain probabilities.
For example
\begin{eqnarray*}
& P(X=x_0|Y=y_1) = 0.9 \\
& P(X=x_0|Y=y_2) = 0.1 \\
\end{eqnarray*}
</li>
<li> Thus if the hidden state $x_0$ ,it is likely to emit a observed state $Y=y_1$ with
probability 0.9 and observed state $y_1$ with probability 0.1
</li>
<li> Thus we can consider than 90\% of time if we observe the state $y_1$
and 10\% of times we will observe the $y_2$
</li>
<li> The random variables ${Y}$ are not independent nor do they represent samples
from a Markov process.
</li>
<li> However given a realization ${X_i=x_i}$ the random variable
$Y_i$ is independent of other random variables ${X}$ and therefore other ${Y}$
</li>
<li> Given that we know the hidden/latent state,the observation probabilities
are independent.
\begin{eqnarray*}
P(Y_1 Y_2 | X=x_i) = P(Y_1 | X=x_i) P(Y_2 | X=x_i)
\end{eqnarray*}
</li>
<li> The sequence of observation/emission and corresponding probabilities
that emission corresponds to hidden state is specified by a emission matrix.
</li>
<li> If N is the number of state and M is number of observations
the emission matrix is $NxM$ matrix.
</li>
<li> The model is called discrete hidden Markov model since the emission probabilities
are discrete in nature,another class of hidden Markov models exist which are called continuous hidden
Markov model wherein the emission probabilities are continuous and modeled using
parametric distribution.
<h4>
Forward algorithm</h4>
</li>
<li> The probability of observed sequence given we are in a hidden state $z_n$ can be computed using forward algorithm
</li>
<li> In forward algorithm we compute the probability of observed sequence from first element of sequence
to last element of sequence as opposed to backward algorithm where we compute the same starting from
last sequence moving backward for 1st element of sequence.
</li>
<li> The forward and backward algorithm can be used to compute the probability of observed sequence
</li>
<li> The idea is to estimate the underlying hidden states which are Markov chains.
</li>
<li> Since we have N hidden states we can compute NXL matrix containing the probabilities
of observing the hidden state ,where L is length of sequence.
</li>
<li> The result is stored in the matrix $_\alpha$
</li>
<li> Each column of matrix $_\alpha$ ie $_\alpha(j,i)$ provides the probabilities of observing the sequence at each increment of the sequence.
</li>
<li> The Forward algorithm computes a matrix of state probabilities which can be used to assess the probability of being in each of the states at any given time in the sequences.
as $\sum_j \alpha(j,len-1)$
\begin{eqnarray*}
Let \\
& \alpha(z_n) =p(x_1,\ldots,x_n,z_n) \\
& \alpha(z_1) =p(x_1,z_n)=p(x_1|z_1)p(z_1) \\
& \alpha(z_{n-1}) =p(x_1,\ldots,x_{n-1},z_{n-1}) \\
& \alpha(z_n) =\sum_{z_{n-1}}p(x_1,\ldots,x_{n-1},x_n,z_{n-1},z_n) \\
& \alpha(z_n) =\sum_{z_{n-1}}p(x_1,\ldots,x_{n-1},z_{n-1})P(x_n,z_n|x_1,\ldots,x_{n-1},z_{n-1}) \\
& \alpha(z_n) =\sum_{z_{n-1}}p(x_1,\ldots,x_{n-1},z_{n-1})P(x_n|z_n,x_1,\ldots,x_{n-1},z_{n-1})\\
& P(z_n|z_n,x_1,\ldots,x_{n-1},z_{n-1}) \\
& \text{Since $x_n$ is independent of all other states given $z_n$}\\
& \text{Since $z_n$ is independent of all other $z_i$ given $z_{n-1}$} \\
&=\sum_{z_{n-1}}p(x_1,\ldots,x_{n-1},z_{n-1})P(x_n|z_n)P(z_n|z_{n-1}) \\
& \alpha(z_n) =\sum_{z_{n-1}}\alpha(z_{n-1}) P(x_n|z_n) P(z_n | z_{n-1})\\
\end{eqnarray*}
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
/**
* @brief forwardMatrix : method computes probability
* compute p(x1 ... xn,zn)
* using the forward algorithm
* @param sequence : is input observation sequence
*/
void forwardMatrix(vector<int> &sequence)
{
int len=sequence.size();
for(int i=0;i<len;i++)
{
for(int j=0;j<_nstates;j++)
{
if(i==0)
_alpha(j,i)=_emission(j,sequence[i])*_initial(0,j);
else
{
float s=0;
//average over pos
for(int k=0;k<_nstates;k++)
s=s+_transition(k,j)*_alpha(k,i-1);
_alpha(j,i)=_emission(j,sequence[i-1])*s;
}
}
//stores the confidence and normalizing factor
float scale=0;
for(int j=0;j<_nstates;j++)
{
scale=scale+_alpha(j,i);
}
//normalizing factor is set to 1 for initial value
scale=1.f/scale;
if(i==0)
_scale(0,i)=1;
else
_scale(0,i)=scale;
//normalize the probability values of hidden
//states
for(int j=0;j<_nstates;j++)
{
_alpha(j,i)=scale*_alpha(j,i);
}
}
}
</script>
<h4>
Observation Sequence Likelyhood</h4>
</li>
<li> This if we are given a random sequence of observations $x_1,\ldots,x_n$
</li>
<li> Starting from $\alpha(z_1)$ computer $\alpha(z_n)$
</li>
<li> After which $P(X={x_1,\ldots,x_n})=\sum_{z_n} \alpha(z_n)$ can be computed.
</li>
<li> This gives us a estimate of probability of observing the sequence $x_1,\ldots,x_n$
using the forward algorithm.
</li>
<li> The probability estimate is often computed as log probability
\begin{eqnarray*}
& P(x_1,\ldots,x_n) = \sum_{z_n} \alpha(z_n) \\
& prob= \prod_{i=1}^n \sum_{z_n} \alpha(z_n) \\
& logprob = \sum_n log(\sum{z_n} \alpha(z_n)) \\
\end{eqnarray*}
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
/**
* @brief likelihood : method to compute the log
* likelihood of observed sequence
* @param sequence :input observation sequence
* @return
*/
float likely hood(vector<int> sequence)
{
float prob=0;
//computing the probability of observed sequence
//using forward algorithm
forwardMatrix(sequence);
backwardMatrix(sequence);
//computing t}he log probability of observed sequence
for(int i=0;i<sequence.size()+1;i++)
{
//for(int j=0;j<_nstates;j++)
{
prob=prob+std::log(_scale(0,i));
}
}
return -prob;
}
</script>
<h4>
Sequence Classification</h4>
</li>
<li> Again for sequence classification assume we have two hidden markov models
$\theta_1 = (\pi_!,trans_1,emission_2)$ and $\theta_1 = (\pi_2,trans_2,emission_2)$
</li>
<li> Given a observation sequence ${X}={x_1,\ldots,x_n}$ we compute the probability
of observing the sequence or probability that models have generate the observation sequence.
</li>
<li> The observation sequence is estimated to be produced by the model which exhibits the highest
probability to have generated the sequence.
\begin{eqnarray*}
y = argmax_{n=1}^N prob({X} | \theta_n)
\end{eqnarray*}
<h4>
Code</h4>
</li>
<li> code for discrete hidden Markov models can be found at git repository
<a href="https://github.com/pi19404/OpenVision">https://github.com/pi19404/OpenVision</a> in files \<b>ImgML/hmm.hpp</b> and <b>ImgML/hmm.cpp</b></li>
</ul>
<div style="display: block; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: normal; margin: 12px auto 6px;">
<b>The PDF Version of the document can be found below</b><br />
<div style="font-weight: normal;">
<br /></div>
<div style="font-weight: normal;">
<a href="http://www.scribd.com/doc/208878524/Implementation-of-discrete-hidden-markov-model-for-sequence-classification-in-C-using-Eigen" style="text-decoration: underline;" title="View Implementation of discrete hidden markov model for sequence classification in C++ using Eigen on Scribd">Implementation of discrete hidden markov model for sequence classification in C++ using Eigen</a> by <a href="http://www.scribd.com/pi19404" style="text-decoration: underline;" title="View pi194043's profile on Scribd">pi194043</a></div>
</div>
<iframe class="scribd_iframe_embed" data-aspect-ratio="0.708006279434851" data-auto-height="false" frameborder="0" height="600" id="doc_34331" scrolling="no" src="//www.scribd.com/embeds/208878524/content?start_page=1&view_mode=scroll&access_key=key-2ef79if5u8kvq97rf12x&show_recommendations=true" width="100%"></iframe>pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-16013369940329186002014-04-24T01:17:00.002+05:302014-08-13T11:18:24.289+05:30Markov chain implementation in C++ using Eigen<link href="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/common.css" rel="stylesheet" type="text/css"></link>
<br />
<h1>
<div class="allcaps">
Markov Chains
</div>
</h1>
<h4>
Introduction</h4>
In this article we will look at markov models and its application
in classification of discrete sequential data.
<br />
<ul>
<li> Markov processes are examples of stochastic processes that generate random sequences of outcomes or
states according to certain probabilities.
</li>
<li> Markov chains can be considered mathematical descriptions of Markov models with a discrete set of states.
</li>
<li> Markov chains are integer time process ${X_n,n\ge 0}$ for which each random variable
$X_n$ is integer valued and depends on the past only through most recent random variable
$X_{n-1}$ for all integer $n\geq 1$.
</li>
<li> ${X_n,n\in N}$ is a discrete Markov chain on state space $S={1,\ldots,M}$
</li>
<li> At each time instant t,The system changes state ,and makes a transition.
</li>
<li> The markov chains follow the markovian and stationarity property.
</li>
<li> For a first order markov chain,the markov property states that the state of the system at time $t+1$ depends only
on the state of the system at time $t$.The markov chain is also said to be memoryless
due to this property.
\begin{eqnarray*}
& Pr(X_{t+1} = x_{t+1} |X_{t} = {x_1 \ldots x_t} = Pr(X_{t+1} = x_{t+1} |X_{t} = x_t)
\end{eqnarray*}
</li>
<li> A stationarity assumption is also made which implies that markov property
is independent of time.
\begin{eqnarray*}
& Pr(X_{t+1} = x_i | X_{t} = x_j) = P_{i,j}
& \text{for $\forall$ t and $\forall i,j \in {0 \ldots M}$}
\end{eqnarray*}
</li>
<li> Thus we are looking at processes whose sample functions are sequence of integers
between ${1 \ldots M}$.
</li>
<li> Thus markov process is parameterized by transition probability $P_{ij}$ and intital probability
$P_{i0}$
</li>
<li> Markov chains can be represented by directed graphs,where each state is represented
by a node and directed arc represents a non zero transition probability.
</li>
<li> If a markov chain has M states then transition probability can be represented by
a $MxM$ matrix.
\begin{eqnarray*}
&T =\begin{bmatrix}
P_{11} & P_{22} & \ldots &P_{1M} \\
P_{21} & P_{22} & \ldots & P_{2M} \\
\ldots \\
P_{M1} & P_{M2} & \ldots & P_{MM} \\
\end{bmatrix}
\\
&\sum_{j} P_{ij} = 1
\end{eqnarray*}
</li>
<li> The matrix T is stochastic matrix where elements in each row sum to 1
</li>
<li> This implies that it is necessary for transition to occur from present
state to one of the M states.
</li>
<li> The probability of sequence being generated by markov chain is given by
\begin{eqnarray*}
&P({X}) = \pi(x_0)*\prod_{t=1}^T p(x_t | x_{t-1}) \\
& \text{$p(x_t | x_{t-1})$ is the probability of observing the sequence $x_t$ at} \\
\end{eqnarray*}
time instant t given the present state is $t-1$
</li>
<li> Let us consider a 2 models with following initial transition and probability
matrix.
\begin{eqnarray*}
& \pi_1 =
\begin{bmatrix}
1 & 0 & 0 \\
\end{bmatrix}
\\
& T_1 =
\begin{bmatrix}
0.6 & 0.4 & 0 \\
0.3 & 0.3 & 0.4 \\
0.4 & 0.1 & 0.5 \\
\end{bmatrix}
<br />
& \pi_2 =
\begin{bmatrix}
0.1 & .5 & 0.4
\end{bmatrix}
\\
& T_2 =
\begin{bmatrix}
0.9 & 0.05 & 0.05 \\
0.3 & 0.1 & 0.6 \\
0.3 & 0.5 & 0.2 \\
\end{bmatrix}
\end{eqnarray*}
<h4>
Sequence Classification</h4>
</li>
<li> The sequence generate from these two markov chains
\begin{eqnarray*}
& S_1=
\begin{bmatrix}
1 & 2 & 1 & 2 & 3 \\
3 & 3 & 2 & 1 & 1 \\
\end{bmatrix}
\\
& S_2=
\begin{bmatrix}
3 & 2 & 1 & 1 & 1 \\
1 & 1 & 1 & 1 & 1 \\
\end{bmatrix}
\end{eqnarray*}
</li>
<li> In sequence 1 since $P_{13}=0$,we can observe there is no transition from 1 to 3
and dominant transition is expected to be from $1->1$.
</li>
<li> In sequence 2 since dominant transition is from $1->1$ we can observe a long
sequence of 1's.
</li>
<li> We can also compute the probability that the sequence has been generate from
a given markov process.
</li>
<li> The sequence 1 has probability of $8.6400e^{-05}$ from the 1st model
and $ 2.4300e^{-07}$ from second model.
</li>
<li> The sequence 2 has probability of 0 being generate from 1st model
and 0.00287 from 2nd model.
</li>
<li> Thus if we have sequence and know it is being generate from 1 of 2 models we can always
predict the model the sequence has been generated from by choosing the model
which generates the maximum probability.
</li>
<li> Thus we can use markov chain for sequence modelling and classification.
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
/**
* @brief The markovChain class : markovChain is a class
* which encapsulates the representation of a discrete markov
* chain.A markov chain is composed of transition matrix
* and initial probability matrix
*/
class markovChain
{
public:
markovChain(){};
/* _transition holds the transition probability matrix
* _initial holds the initial probability matrix
*/
MatrixXf _transition;
MatrixXf _initial;
/**
* @brief setModel : function to set the parameters
* of the model
* @param transition : NXN transition matrix
* @param initial : 1XN initial probability matrix
*/
void setModel(Mat transition,Mat initial)
{
_transition=EigenUtils::setData(transition);
_initial=EigenUtils::setData(initial);
}
void setModel(Mat transition,Mat initial)
{
_transition=EigenUtils::setData(transition);
_initial=EigenUtils::setData(initial);
}
/**
* @brief computeProbability : compute the probability
* that the sequence is generate from the markov chain
* @param sequence : is a vector of integral sequence
* starting from 0
* @return : is probability
*/
float computeProbability(vector<int> sequence)
{
float res=0;
float init=_initial(0,sequence[0]);
res=init;
for(int i=0;i<sequence.size()-1;i++)
{
res=res*_transition(sequence[i],sequence[i+1]);
}
return res;
}
}
</script>
<h4>
Generating a Sequence</h4>
</li>
<li> The idea behind generating a sequence from a markov process is to use a uniform
random number generator.
</li>
<li> For each row of initial probability or transition matrix select state
which is most likely.
</li>
<li> For example if the row contains values $[0.6,0.4,0]$
</li>
<li> If a uniform random value generates a value between 0 and 0.6 then state 0 is returned
</li>
<li> If a random value between 0.6 and 1 is generated then state 1 is returned.
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
/**
* @brief initialRand : function to generate a radom state
* @param matrix : input matrix
* @param index ; row of matrix to consider
* @return
*/
int initialRand(MatrixXf matrix,int index)
{
float u=((float)rand())/RAND_MAX;
cerr << u << endl;
float s=matrix(0,0);
int i=0;
//select the index corresponding to the highest probability
//or if all the cols of matrix have transitioned
while(u>s & (i<matrix.cols()))
{
i=i+1;
s=s+matrix(index,i);
}
return i;
}
</script>
</li>
<li> First step is to use the above method to select a inital state of matrix
by passing the initial probability matrix as input.
</li>
<li> Next random state will be selected from the transition probability
by passing the transition probability matrix as input.
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
/**
* @brief generateSequence is a function that generates
* a sequence of specified length
* @param n : is the length of the sequence
* @return : is a vector of integers representing
* generated sequence
*/
vector<int> generateSequence(int n)
{
vector<int> result;
result.resize(n);
int i=0;
int index=0;
//select a random initial value of sequence
int init=initialRand(_initial,0);
result[i]=init;
index=init;
for(i=1;i<n;i++)
{
//select a random transition to next sequence state
index=initialRand(_transition,index);
result[i]=index;
}
return result;
}
</script>
<h4>
Code</h4>
The code can be found in <a href="https://github.com/pi19404/OpenVision">https://github.com/pi19404/OpenVision</a> in files
{ImgML/markovchain.cpp} and {ImgML/markovchain.hpp} .
</li>
</ul>
<div>
<b>The PDF Version of the document can be found below</b></div>
<div>
<b></b><br />
<div>
<b><br /></b></div>
<b>
</b></div>
<div style="-x-system-font: none; display: block; font-family: Helvetica,Arial,Sans-serif; font-size-adjust: none; font-size: 14px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; margin: 12px auto 6px auto;">
<a href="http://www.scribd.com/doc/208703018/Markov-chain-implementation-in-C-using-Eigen" style="text-decoration: underline;" title="View Markov chain implementation in C++ using Eigen on Scribd">Markov chain implementation in C++ using Eigen</a> by <a href="http://www.scribd.com/pi19404" style="text-decoration: underline;" title="View pi194043's profile on Scribd">pi194043</a></div>
<iframe class="scribd_iframe_embed" data-aspect-ratio="0.708006279434851" data-auto-height="false" frameborder="0" height="600" id="doc_6286" scrolling="no" src="//www.scribd.com/embeds/208703018/content?start_page=1&view_mode=scroll&access_key=key-im384w0sesduolw2j43&show_recommendations=true" width="100%"></iframe>pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-37009401328913944112014-04-24T01:16:00.001+05:302014-08-13T11:27:51.647+05:30Gaussian Multivariate Distribution -Part 1<link href="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/common.css" rel="stylesheet" type="text/css"></link>
<h1>
<div class="allcaps">
Multi Variate Gaussian Distribution - Part 1
</div>
</h1>
<h4>
Introduction</h4>
In this article we will look at the multivariate gaussian distribution.
<br />
<ul>
<li> The mutivariate gaussian distribution is parameterized by mean vector $\boldsymbol\mu$
and covariance matrix $\boldsymbol\Sigma$.
\begin{eqnarray*}
& f_{\mathbf x}(x_1,\ldots,x_k) =\frac{1}{\sqrt{(2\pi)^k|\boldsymbol\Sigma|}}
\exp\left(-\frac{1}{2}({\mathbf x}-{\boldsymbol\mu})^T{\boldsymbol\Sigma}^{-1}({\mathbf x}-{\boldsymbol\mu})\right),
\\
& where\\
& \text{$\boldsymbol\mu$ is a Nx1 mean vector }\\
& \text{$\boldsymbol\Sigma$ is NxN matrix covariance matrix} \\
& \text{$|\boldsymbol\Sigma|$ is the determinant of $\boldsymbol\Sigma$} \\
\end{eqnarray*}
</li>
<li> The mutivariate gaussian is also used as probability density function of the vector ${X}$
</li>
<li> A naive way of implementation is to directly perform the computation as in the equation
to get the result.
</li>
<li> A Gaussian is defined
</li>
<li> Since ill be using a lot of opencv conversion routines are defined for Opencv
cv::Mat data structure to Eigen::MatrixXf data structure.
</li>
<li> when loading the covarince matrix ,the determinant,inverse etc are also computed which
would be later required for probability calculation
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
void setMean(Mat &v)
{
Map<Eigen::Matrix<float,Dynamic,Dynamic,Eigen::RowMajor> >
mappedMat((float *)v.data(),1,v.size()) ;
_mu=mappedMat;
}
void setSigma(cv::Mat &v)
{
Map<Eigen::Matrix<float,Dynamic,Dynamic,Eigen::RowMajor> >
mappedMat((float *)v.data,v.rows,v.cols) ;
_Sigma=mappedMat;
_dim=v.rows;
_det=_Sigma.determinant();
_scale=1.f/(pow(2*PI*_dim*_det,0.5));
_invsigma=_Sigma.inverse();
}
MatrixXf setData(cv::Mat &v)
{
Map<Eigen::Matrix<float,Dynamic,Dynamic,Eigen::RowMajor> >
mappedMat((float *)v.data,1,v.cols) ;
MatrixXf ref=mappedMat;
return ref;
}
</script>
</li>
<li> The probability computation is simply writing out the formula
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
void validate(float &res)
{
if(res<0)
res=0;
if(res>1)
res=1;
if(isnan(res))
res=0;
}
float Prob(Mat &x)
{
MatrixXf tmp=setData(x);
float res=0;
MatrixXf tmp1=(tmp-_mu);
MatrixXf tmp2=tmp1*_invsigma*tmp1.transpose();
res=scale*tmp2(0,0);
validate(res);
return res;
}
</script>
</li>
<li> The covariance matrix is postive semidefinate and symmteric
</li>
<li> The Cholesky decomposition of a symmetric, positive definite matrix $\boldsymbol\Sigma$ decom-
poses A into a product of a lower triangular matrix L and its transpose.
</li>
<li> Thus the product
\begin{eqnarray*}
& \boldsymbol\Sigma=LL^T \\
& \boldsymbol\Sigma^{-1}=(LL^T)^{-1}=L^{-T}L^{-1} \\
& {\mathbf y}^T{\boldsymbol\Sigma}^{-1}{\mathbf y} \\
& {\mathbf y}^T{\boldsymbol\Sigma}^{-1}{\mathbf y} \\
& {\mathbf y}^T{L^{-T}L^{-1}}{\mathbf y} \\
& \left({L^{-1}\mathbf y}\right)^T\left({L^{-1}\mathbf y}\right)
\end{eqnarray*}
</li>
<li> thus we can only compute $\left({L^{-1}\mathbf y}\right)$ and take its tranpose
</li>
<li> Thus we can perform the Cholskey factorization of the covariance matrix to find $\mathbf L$
</li>
<li> Then we take the inverse of $\mathbf L $
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
float Prob(Mat &x)
{
MatrixXf tmp=setData(x);
float res=0;
MatrixXf tmp1=(tmp-_mu).transpose();
tmp1=_LI*tmp1;
MatrixXf tmp2=tmp1.transpose()*tmp1;
res=tmp2(0,0);
validate(res);
return res;
}
</script>
<h4>
Code</h4>
The code can be found at git repository <a href="https://github.com/pi19404/OpenVision">https://github.com/pi19404/OpenVision</a>
in files ImgML/gaussian.hpp and ImgML.gaussian.cpp files.
</li>
</ul>
<div>
The PDF Version of the document can be found below</div>
<div style="-x-system-font: none; display: block; font-family: Helvetica,Arial,Sans-serif; font-size-adjust: none; font-size: 14px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; margin: 12px auto 6px auto;">
<a href="http://www.scribd.com/doc/208251593/Gaussian-Multivariate-Distribution-Part-1" style="text-decoration: underline;" title="View Gaussian Multivariate Distribution -Part 1 on Scribd">Gaussian Multivariate Distribution -Part 1</a> by <a href="http://www.scribd.com/pi19404" style="text-decoration: underline;" title="View pi194043's profile on Scribd">pi194043</a></div>
<iframe class="scribd_iframe_embed" data-aspect-ratio="0.708006279434851" data-auto-height="false" frameborder="0" height="600" id="doc_5443" scrolling="no" src="//www.scribd.com/embeds/208251593/content?start_page=1&view_mode=scroll&access_key=key-1uzzmah6ky8k48gaq4gz&show_recommendations=true" width="100%"></iframe>pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-80975839721846827202014-04-24T01:15:00.001+05:302014-08-13T13:00:12.122+05:30A linear channel filter<link href="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/common.css" rel="stylesheet" type="text/css"></link>
<h1>
<div class="allcaps">
Linear Channel Filter
</div>
</h1>
<h4>
Introduction</h4>
In this article we will look implementation of channel filter.
<br />
<ul>
<h4>
Channel Filter</h4>
<li> Point wise image processing operation are applied at each point of image
</li>
<li> Some time transformation if pixel intensity at a point in a multi channel image
is dependent on pixel intensity at other point in the image.
</li>
<li> The present implementation of channel filter is used in case the channel transformation
is linear as in the case of color space conversion ,matrix inversion applied across each channels
of image etc.
</li>
<li> A generic channel kernel is define whose column and/or row dimension equals the number of channels in the image
</li>
<li> We just iterate over the pixel values,apply the kernel and then proceed
to next pixel value.
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
void apply(Mat &src,Mat &dst)
{
int ch=src.channels();
Mat row=Mat(ch,1,CV_32F);
dst.create(src.rows,src.cols,CV_32FC(ch));
//iterate over rows
for(int i=0;i<src.rows;i++)
{
float *ptr=src.ptr<float>(i);
float *dptr=dst.ptr<float>(i);
//iterate over columns
for(int j=0;j<src.cols*ch;j=j+ch)
{
#pragma unroll
for(int k=0;k<ch;k++)
{
row.at<float>(k)=ptr[j+k];
}
//apply the kernel as dot product
Mat res=kernel*row;
#pragma unroll
//store the result
for(int k=0;k<ch;k++)
{
dptr[j+k]=res.at<float>(k);
}
}
}
}
</script>
<h4>
Code</h4>
The code for the same can be found at git repository <a href="https://github.com/pi19404/OpenVision">https://github.com/pi19404/OpenVision</a>
in files ImgProc/channelfilter.cpp and ImgProc/channelfilter.hpp files.
</li>
</ul>
<div style="display: block; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: normal; margin: 12px auto 6px;">
<b>The PDF version of the document can be found below</b><br />
<div style="font-weight: normal;">
<br /></div>
<div style="font-weight: normal;">
<a href="http://www.scribd.com/doc/207600721/A-linear-channel-filter" style="text-decoration: underline;" title="View A linear channel filter on Scribd">A linear channel filter</a> by <a href="http://www.scribd.com/pi19404" style="text-decoration: underline;" title="View pi194043's profile on Scribd">pi194043</a></div>
</div>
<iframe class="scribd_iframe_embed" data-aspect-ratio="0.708006279434851" data-auto-height="false" frameborder="0" height="600" id="doc_42529" scrolling="no" src="//www.scribd.com/embeds/207600721/content?start_page=1&view_mode=scroll&access_key=key-155o96a7rrubg5x58bay&show_recommendations=true" width="100%"></iframe>pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-60008421062112263122014-04-24T01:14:00.001+05:302014-08-13T13:28:23.524+05:30Fast 2D Separable Symmetric/Anti-Symmmetric Convolution<link href="https://googledrive.com/host/0B-pfqaQBbAAtenZiNDItSDFTSTg/common.css" rel="stylesheet" type="text/css"></link>
<h1>
<div class="allcaps">
Fast 2D Separable Symmetric/Anti-Symmetric Convolution</div>
</h1>
<h4>
Introduction</h4>
In the article we will look at algorithm for Fast 2D Convolution.
<br />
<h4>
Separable Symmetric/Anti-Symmetric Convolution</h4>
<ul>
<li> This article presents a convolution algorithm involving a separable symmetric/anti symmetric kernel.
</li>
<li> Such kernels are common in image processing like blurring,edge detection etc
</li>
<li> This optimization helps in speeding up many routines .
</li>
<li> Another requirement being addressed is we may have multiple kernels that need to be applied to the same image
in application such as computing the basis representation of rectangular path of the image.
</li>
<li> since we are traversing the image,we can perform computation of all these kernels simultaneously
instead of independent traversals.
</li>
<li> It is to be noted that this optimization is specific to symmetric/antisymmetric separable
filters.
</li>
<li> We will be assuming that all the kernel are of the same size as well
</li>
<li> Since kernels are separable we will perform vertical convolution followed by horizontal convolution.
</li>
<li> One of the considerations is to minimize the row accesses .
</li>
<li> Another consideration is to perform a single pass over the entire source image
</li>
<li> Let $n*2+1$ be the kernel size.
</li>
<li> The convolution filter is initialized by accepting all the row and column filter coefficients
as well as the information if the filter is symmetric or not
</li>
<li> A class called SeperableSConvolution implemented this algorithm
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
class SeperableSConvolution
{
public:
SeperableSConvolution();
vector<mat> rowk;//vector of row filter
vector<mat> colk;//vector of column filters
vector<bool> symmetric; //info if filter is symmetric or not
int N;//number of channels in the output image
//function to set the filter parameters
void setKernel(Mat row,Mat col,bool symm);
//function to clear the filter parameters
void clearKernel();
//apply a set of separable symmetric/anti-symmetric filters on
//the source image and return a multi channel destination image
////function to perform separable filtering
void apply(Mat &src,Mat &dst);
};
</script>
<h4>
Vertical Convolution</h4>
</li>
<li> First vertical convolution is considered
</li>
<li> If kernel size is $2N+1$ ,we need to access same number of rows
</li>
<li> This if we are applying the filter at row j,we need to access elements from rows
from $j-k$ to $j+k$ where $k \in 0..N$
\begin{eqnarray}
dst(x,y) = \sum_{i,k=-N}^{k=N} g(k+N)I(x,y+k)
\end{eqnarray}
</li>
<li> The above needs to be processed for each $(x,y)$
</li>
<li> Since we need to reduce the number of row access,access rows from $j-N,j+N$ are performed
for each j,compute the convolution for each x.
</li>
<li> Since with change in x no new rows are being accessed,hence
we compute convolution for each element of the present row.
</li>
<li> Each of the rows need to be multiplied with suitable filter coefficients.
</li>
<li> since the filter is symmetric or anti symmetric the filter coefficients
$g_k$ is multiplied with elements of rows $j-k$ and $j+k$
</li>
<li> The resultant sum of accumulated,this is performed for all the rows.
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
for(int y=0;y<s.height;y++)
{
//pointer to the source and destination
float *srow0 = (float*)(src.data + src.step*y),*srow1=0;
float *drow = (float*)(dst.data + dst.step*y);
//performing vertical convolution
//using the row kernel
//computing g[0]*f(x,y)
for( x = 0; x < s.width; x++ )
{
for(int l=0;l<ch;l++)
{
row[x*ch+l] = srow0[x]*rowk[l].at<float>(n);
}
}
//computing g[-n/2]*f(x,y-n/2)
//performing vertical convolution accessing n rows about current row
//accessing a 2 rows at a time,performing computation
for(int k=1;k<=n;k++)
{
//accessing the vertical abouts about the current row
srow0 = (float*)(src.data + src.step*std::max(y-k,0));
srow1 = (float*)(src.data + src.step*std::min(y+k,s.height-1));
for(int x=0;x<s.width;x++)
{
//applying different vertical kernels
//accumulating the sum
for(int l=0;l<ch;l++)
{
float p=srow0[x]+(1*(symmetric[l]?1:-1))*srow1[x];
row[x*ch+l]+=rowk[l].at<float>(k)*(p);
}
}
}
</script>
<h4>
Horizontal Convolution</h4>
</li>
<li> Once vertical convolution is done we proceed to perform horizontal convolution
</li>
<li> Since in horizontal convolution there is only a single row access ,it is relatively
simple process.
</li>
<li> The output image is a multi channel image,containing number of channels as desired
number of input kernels being applied to the source image.
<script class="brush: cpp" type="syntaxhighlighter"> <![CDATA[
for(x=0;x<s.width;x++)
{
//apply horizontal kernels
//g[0]*f(x,y)
for(int l=0;l<ch;l++)
{
res[l]=row[x*ch+l]*colk[l].at<float>(n);
}
//accumulating the sum for g[-N/2+k]f(x-n/2+k)
for(int k=1;k<=n;k++)
{
for(int l=0;l<ch;l++)
{
float p=(row[(x+k)]+(1*symmetric[l]?1:-1)
*row[(x-k)])*colk[l].at<float>(k);
res[l]=res[l]+p;
}
}
//storing the result of convolution
//output image contains number of channels as different input filters
for(int l=0;l<ch;l++)
{
drow[x*ch+l]=res[l];
}
}
</script>
<h4>
Code</h4>
</li>
<li>
The class SeperableSConvolution defines a class for performing
separable symmetric/ant-symmetric convolution/
Code is available in repository <a href="https://github.com/pi19404/OpenVision/">https://github.com/pi19404/OpenVision/</a>
at Improper/convolution.hpp and ImgProc/convolution.cpp
files.
</li>
</ul>
<div style="-x-system-font: none; display: block; font-family: Helvetica,Arial,Sans-serif; font-size-adjust: none; font-size: 14px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; margin: 12px auto 6px auto;">
<br /></div>
<div style="-x-system-font: none; display: block; font-family: Helvetica,Arial,Sans-serif; font-size-adjust: none; font-size: 14px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; margin: 12px auto 6px auto;">
<br /></div>
<div style="display: block; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: normal; margin: 12px auto 6px;">
<b>The PDF version of the article can be found below</b></div>
<div style="-x-system-font: none; display: block; font-family: Helvetica,Arial,Sans-serif; font-size-adjust: none; font-size: 14px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; margin: 12px auto 6px auto;">
<a href="http://www.scribd.com/doc/207410165/Fast-2D-Separable-Symmetric-Anti-Symmmetric-Convolution" style="text-decoration: underline;" title="View Fast 2D Separable Symmetric/Anti-Symmmetric Convolution on Scribd">Fast 2D Separable Symmetric/Anti-Symmmetric Convolution</a> by <a href="http://www.scribd.com/pi19404" style="text-decoration: underline;" title="View pi194043's profile on Scribd">pi194043</a></div>
<iframe class="scribd_iframe_embed" data-aspect-ratio="0.708006279434851" data-auto-height="false" frameborder="0" height="600" id="doc_70672" scrolling="no" src="//www.scribd.com/embeds/207410165/content?start_page=1&view_mode=scroll&access_key=key-18ievw4p9mpt1j419t9j&show_recommendations=true" width="100%"></iframe>pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-20931068794363375842014-04-24T01:13:00.001+05:302014-04-24T01:13:09.722+05:30Modified Canny Edge Detection<p style=" margin: 12px auto 6px auto; font-family: Helvetica,Arial,Sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; display: block;"> <a title="View Modified Canny Edge Detection on Scribd" href="http://www.scribd.com/doc/205993666/Modified-Canny-Edge-Detection" style="text-decoration: underline;" >Modified Canny Edge Detection</a> by <a title="View pi194043's profile on Scribd" href="http://www.scribd.com/pi19404" style="text-decoration: underline;" >pi194043</a></p><iframe class="scribd_iframe_embed" src="//www.scribd.com/embeds/205993666/content?start_page=1&view_mode=scroll&access_key=key-20ho0xabbdzc87xt9tir&show_recommendations=true" data-auto-height="false" data-aspect-ratio="0.708006279434851" scrolling="no" id="doc_62119" width="100%" height="600" frameborder="0"></iframe>pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-26561583974019981912014-04-24T01:12:00.001+05:302014-04-24T01:12:05.431+05:30Polynomial Approximation Of a 2D Signal<p style=" margin: 12px auto 6px auto; font-family: Helvetica,Arial,Sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; display: block;"> <a title="View polynomial approximation of a 2D signal on Scribd" href="http://www.scribd.com/doc/204923909/polynomial-approximation-of-a-2D-signal" style="text-decoration: underline;" >polynomial approximation of a 2D signal</a> by <a title="View pi194043's profile on Scribd" href="http://www.scribd.com/pi19404" style="text-decoration: underline;" >pi194043</a></p><iframe class="scribd_iframe_embed" src="//www.scribd.com/embeds/204923909/content?start_page=1&view_mode=scroll&access_key=key-1f0324kod4ulo6c9kdz0&show_recommendations=true" data-auto-height="false" data-aspect-ratio="0.708006279434851" scrolling="no" id="doc_56434" width="100%" height="600" frameborder="0"></iframe>pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0tag:blogger.com,1999:blog-8650972056239106530.post-67586870836392325992014-04-24T01:09:00.003+05:302014-04-24T01:09:27.836+05:30Polynomial Approximation of 1D signal<p style=" margin: 12px auto 6px auto; font-family: Helvetica,Arial,Sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; display: block;"> <a title="View Polynomial Approximation of 1D signal on Scribd" href="http://www.scribd.com/doc/204804926/Polynomial-Approximation-of-1D-signal" style="text-decoration: underline;" >Polynomial Approximation of 1D signal</a> by <a title="View pi194043's profile on Scribd" href="http://www.scribd.com/pi19404" style="text-decoration: underline;" >pi194043</a></p><iframe class="scribd_iframe_embed" src="//www.scribd.com/embeds/204804926/content?start_page=1&view_mode=scroll&access_key=key-2ctrhemkt8nmed7k25qk&show_recommendations=true" data-auto-height="false" data-aspect-ratio="0.708006279434851" scrolling="no" id="doc_11476" width="100%" height="600" frameborder="0"></iframe>pihttp://www.blogger.com/profile/03926668131774817799noreply@blogger.com0