<?php
$link = "code";
$title = "Code";
include("inc/header.php");

function printCode($file)
{
   echo "<a href=\"$file\" onClick=\"recordOutboundLink(this, 'Publications', '$file');return false;\">";
}

?>

<script language="JavaScript" type="text/JavaScript">
function summaryit(entry_name, entry)
{
   var span_entry_bibtex_link = document.getElementById(entry_name + "_bibtex_link");
   if (span_entry_bibtex_link)
   span_entry_bibtex_link.innerHTML = "+BibTeX";

   var span_entry_link = document.getElementById(entry_name + "_summary_link");
   var span_entry = document.getElementById(entry_name);
   if (span_entry_link.innerHTML == "+Summary")
   {
      span_entry_link.innerHTML = "-Summary";
      span_entry.style.color = '#a0a0a0';
      span_entry.style.marginLeft = '10px';
      span_entry.style.marginRight = '25px';
      span_entry.style.padding = '5px';
      span_entry.style.border = '1px solid #7D8085';
      span_entry.style.background = '#000';
      span_entry.style.fontFamily = 'Sans-Serif';
      span_entry.innerHTML = entry;
   }
   else
   {
      span_entry_link.innerHTML = "+Summary";
      span_entry.innerHTML = "";
      span_entry.style.margin = '0px';
      span_entry.style.padding = '0px';
      span_entry.style.border = '0px';
   }
}



var codeShowing=-1;
function showCode(idnum)
{
	var codebox = document.getElementById("codeDesc");
	if (idnum==codeShowing)
	{
		codeShowing = -1;
		codebox.innerHTML = "";
		return;
	}

	codeShowing = idnum;
	if (idnum==0)
		codebox.innerHTML = "";
	else if (idnum==1)
		codebox.innerHTML = "";
	else if (idnum==2)
		codebox.innerHTML = "The following code is the Dirichlet process mixture model sampler as described in our NIPS 2013 paper. It includes code for Gaussian observation models with Normal-Inverse Wishart and Multinomial observation models with a Dirichlet prior." +
			"<p align='center'>[ " + printCode('code/subclusters/dpmm_subclusters_2014-08-06.zip') + "zip</a> ] - [ " + printCode('code/subclusters/dpmm_subclusters_2014-08-06.tar.gz') + "tar.gz</a> ]</p>";
	else if (idnum==3)
		codebox.innerHTML = "The following code infers Temporal Superpixels for a particular video sequence as described in our CVPR 2013 paper." +
		"<p align='center'>[ " + printCode('code/TSP/TSP_2013-06-26.zip') + "zip</a> ] - [ " + printCode('code/TSP/TSP_2013-06-26.tar.gz') + "tar.gz</a> ]</p>";
}

var anchor = '';

function unhighlightBox()
{
   var obj = document.getElementById(anchor);
   if (obj)
      obj.className = "box";
}

function highlightBox(new_anchor)
{
   unhighlightBox();

   if (typeof new_anchor !== 'undefined')
      anchor = new_anchor;
   else
      anchor = window.location.hash.substring(1);
   var thebox = document.getElementById(anchor);
   thebox.className = "boxhover";
}

window.onload = function()
{
   highlightBox();
}

</script>

<h2>Code</h2>
<p align="center">All code is interfaced through <span id="orange">Matlab</span> and has been tested in a <span id="orange">Linux</span> environment compiled with <span id="orange">GCC</span>.</p>
<p align="center">Please contact me by email if you have questions. I will do my best to answer them in a timely fashion.</p>

<p align="center">Shortcuts<br>
<a href="#hdp_subclusters" onclick="javascript:highlightBox('hdp_subclusters');"><img src="research/NIPS2014.jpg"></a>
<a href="#dpmm_subclusters" onclick="javascript:highlightBox('dpmm_subclusters');"><img src="research/NIPS2013.png"></a>
<a href="#tracker" onclick="javascript:highlightBox('tracker');"><img src="research/ICCV2013.png"></a>
<a href="#TSP" onclick="javascript:highlightBox('TSP');"><img src="research/CVPR2013.png"></a>
<a href="#PGIMH" onclick="javascript:highlightBox('PGIMH');"><img src="research/CVPR2011.jpg"></a>

<div class="box" id="hdp_subclusters"><a id="hdp_subclusters"></a>
   <table aligh="center" width=100%>
     <tr>
       <th colspan=2>HDPs with Sub-Cluster Splits</th></tr>
       <td><img src="research/wordCloud.jpg"></td>
       <td>The following code is the Hierarchical Dirichlet process sampler as described in our NIPS 2014 paper. It includes code for a Categorical observation model with a Dirichlet prior.
          <br>[ <?php printCode('code/hdp_subclusters/hdpmm_subclusters_2014-12-07.zip');?>zip</a> ] - [ <?php printCode('code/hdp_subclusters/hdpmm_subclusters_2014-12-07.tar.gz');?>tar.gz</a> ]
       </td></tr>
   </table>
</div><br>

<div class="box" id="dpmm_subclusters"><a id="dpmm_subclusters"></a>
   <table align="center" width=100%>
		<tr>
      <th colspan=2>Dirichlet Process Mixtures</th></tr>
      <td><img src="research/dpmm.png"></td>
      <td>The following code is the Dirichlet process mixture model sampler as described in our NIPS 2013 paper. It includes code for Gaussian observation models with Normal-Inverse Wishart and Multinomial observation models with a Dirichlet prior.</p>A major bug fix was released on 4/8/2014. Previous versions will produce incorrect results.
         <br>[ <?php printCode('code/subclusters/dpmm_subclusters_2014-08-06.zip');?>zip</a> ] - [ <?php printCode('code/subclusters/dpmm_subclusters_2014-08-06.tar.gz');?>tar.gz</a> ]
      </td></tr>
   </table>
</div><br>

<div class="box" id="tracker"><a id="tracker"></a>
        <table align="center" width=100%>
      <tr>
      <th colspan=2>Layered Tracking Sampler</th></tr>
      <tr><td><img src="research/layered_particle_filter.png"></td>
      <td>The following code is from our ICCV 2013 paper on layered tracking. It combines the level-set sampling algorithm in a temporal framework to track multiple objects in videos.
         <br>[ Coming Soon ]
      </td></tr>
  </table>
</div><br>

<div class="box" id="TSP"><a id="TSP"></a>
   <table align="center" width=100%>
		<tr>
      <th colspan=2>Temporal Superpixels</th></tr>
      <td><img src="research/tsp.png"></td>
      <td>The following code infers Temporal Superpixels for a particular video sequence as described in our CVPR 2013 paper.
         <br>[ <?php printCode('code/TSP/TSP_2015-01-12.zip');?>zip</a> ] - [ <?php printCode('code/TSP/TSP_2015-01-12.tar.gz');?>tar.gz</a> ]
      </td></tr>
	</table>
</div>
<br>

<div class="box" id="PGIMH"><a id="PGIMH"></a>
   <table align="center" width=100%>
      <tr>
      <th colspan=2>Level-Set / MRF Sampler</th></tr>
      <td><img src="research/levelset_sampling.jpg"></td>
      <td>The following code is our latest level-set/MRF sampler as described in our ICCV 2013 paper. It fixes errors that were in the ICIP 2012 and CVPR 2011 paper that slightly biased results towards the mode (thank you <a href='http://www.mosaic.ethz.ch/people/janickc' target='_BLANK'>Janick</a> and <a href='http://www.mosaic.ethz.ch/people/ivos' target='_BLANK'>Ivo</a> identifying inconsistencies).
          <br>[ <?php printCode('code/PGIMH/'); ?>zip/tar</a> ]</p>
          <p>For completeness, our erroneous code is listed below. These should not be used and will not sample from the distribution of interest.
          <br>ICIP 2012: [ <?php printCode('code/GIMH/'); ?>zip/tar</a> ]  &nbsp;&nbsp;&nbsp; CVPR 2011: [ <?php printCode('code/BFPS/');?>zip/tar</a> ]
       </td></tr>
   </table>
</div><br>

<?php include("inc/footer.php"); ?>
