<commit_before>---
layout: page
title:  "It's a Bird, It's a Plane!"
subheadline:  "Introduction to image classification"
author: Trisha
#teaser: "Experiments with SIFT features and d3"
---

<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/colorbrewer.v1.min.js"></script>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="http://d3js.org/queue.v1.min.js"></script>

<script src="../blog/heatmap.js"></script>
<link rel="stylesheet" href="../blog/heatmap.css" />

<!--<head>-->

<script>
$(document).ready(function() {
	heatmap_display("../blog/heatmaps/linsvc_lim=500_k=300.json", "#heatmap", "PuRd", 'linsvc');
});
</script>

<!--</head>

<body>-->
![topdoge logo](../images/topdoge.png)  

## The Data  

- Stanford [STL-10 dataset](http://cs.stanford.edu/~acoates/stl10/)
- 10 classes: airplane, bird, car, cat, deer, dog, horse, monkey, ship, truck
- 96x96 px, 3 channel RGB images
- 500 training images, 800 test images per class
- 100000 unlabeled images for unsupervised learning  

![Sample image from each class](../images/all_classes_color.png)

## The Process  

###  Grayscale

Color is not generally a useful feature for object classification, so convert all images to grayscale.  
![same images now in grayscale](../images/all_classes_gray.png)

###  Features  

**Harris Corners**

**Pros:**  

- Easy to understand
- Somewhat customizable  

**Cons:**  

- Sensitive to noise/patterns  

Didn't end up using in final models  
<img class="zoom-img" src="../images/all_classes_harris.png" alt="same images with harris features">  
<!--![same images with harris features](../images/all_classes_harris.png)  -->

**SIFT (Scale-Invariant Feature Transform)**

- Proprietary ([David Lowe](https://en.wikipedia.org/wiki/David_G._Lowe), 1999/2004)  
- Confusing (Difference of Gaussians to generate feature vectors in 128 dimensional space)  
- Works well  

<img class="zoom-img" src="../images/all_classes_sift.png" alt="same images with sift features">  
<!--![same images with sift features](../images/all_classes_sift.png) --> 

Cluster features with K Means, compute feature occurrence histograms, and feed those to the models for train/test.  

## The Results (confusion matrix)  
<div id="heatmap"></div>
<table style="height:60px; width:80%; text-align: center; align: center">
  <tr>
    <td>
    <table ><!--style="width:30%;">-->
        <tr>
         <p>
            <label for="lim" 
                style="display: inline-block; text-align: center"><commit_msg>I give up<commit_after>---
layout: page
title:  "It's a Bird, It's a Plane!"
subheadline:  "Introduction to image classification"
author: Trisha
#teaser: "Experiments with SIFT features and d3"
---

<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/colorbrewer.v1.min.js"></script>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="http://d3js.org/queue.v1.min.js"></script>

<script src="../blog/heatmap.js"></script>
<link rel="stylesheet" href="../blog/heatmap.css" />

<!--<head>-->

<script>
$(document).ready(function() {
	heatmap_display("../blog/heatmaps/linsvc_lim=500_k=300.json", "#heatmap", "PuRd", 'linsvc');
});
</script>

<!--</head>

<body>-->
![topdoge logo](../images/topdoge.png)  

## The Data  

- Stanford [STL-10 dataset](http://cs.stanford.edu/~acoates/stl10/)
- 10 classes: airplane, bird, car, cat, deer, dog, horse, monkey, ship, truck
- 96x96 px, 3 channel RGB images
- 500 training images, 800 test images per class
- 100000 unlabeled images for unsupervised learning  

![Sample image from each class](../images/all_classes_color.png)

## The Process  

###  Grayscale

Color is not generally a useful feature for object classification, so convert all images to grayscale.  
![same images now in grayscale](../images/all_classes_gray.png)

###  Features  

**Harris Corners**

**Pros:**  

- Easy to understand
- Somewhat customizable  

**Cons:**  

- Sensitive to noise/patterns  

Didn't end up using in final models  
<img class="zoom-img" src="../images/all_classes_harris.png" alt="same images with harris features">  
<!--![same images with harris features](../images/all_classes_harris.png)  -->

**SIFT (Scale-Invariant Feature Transform)**

- Proprietary ([David Lowe](https://en.wikipedia.org/wiki/David_G._Lowe), 1999/2004)  
- Confusing (Difference of Gaussians to generate feature vectors in 128 dimensional space)  
- Works well  

<!--<img class="zoom-img" src="../images/all_classes_sift.png" alt="same images with sift features">  -->
![same images with sift features](../images/all_classes_sift.png)  

Cluster features with K Means, compute feature occurrence histograms, and feed those to the models for train/test.  

## The Results (confusion matrix)  
<div id="heatmap"></div>
<table style="height:60px; width:80%; text-align: center; align: center">
  <tr>
    <td>
    <table ><!--style="width:30%;">-->
        <tr>
         <p>
            <label for="lim" 
                style="display: inline-block; text-align: center">
{'fraction_non_alphanumeric': 0.17039654495484885, 'fraction_numerical': 0.022771888496270123, 'mean_word_length': 3.847764034253092, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 69, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '961264', 'n_tokens_mistral': 1820, 'n_tokens_neox': 1670, 'n_words': 451}