Skip to content
This repository
Newer
Older
100644 53 lines (29 sloc) 2.62 kb
0131b7cc »
2012-05-21 initial kittydar with training
1 # Kittydar
79acd48a »
2012-06-13 add sample images to demo, update readme
2
3 Kittydar is short for kitty radar. Kittydar takes an image (canvas) and tells you the locations of all the cats in the image:
0131b7cc »
2012-05-21 initial kittydar with training
4
5 ```javascript
79acd48a »
2012-06-13 add sample images to demo, update readme
6 var cats = kittydar.detectCats(canvas);
0131b7cc »
2012-05-21 initial kittydar with training
7
8 console.log("there are", cats.length, "cats in this photo");
9
10 console.log(cats[0]);
11
12 // { x: 30, y: 200, width: 140, height: 140 }
13 ```
14
37741dd2 »
2012-06-14 add demo url to readme
15 [Kittydar demo](http://harthur.github.com/kittydar)
16
5eed6534 »
2012-06-27 add positive collection cropping code
17 ## Install
0131b7cc »
2012-05-21 initial kittydar with training
18
19 For node:
20
21 ```bash
22 npm install kittydar
23 ```
79acd48a »
2012-06-13 add sample images to demo, update readme
24
0131b7cc »
2012-05-21 initial kittydar with training
25 Or grab the [browser file](http://github.com/harthur/kittydar/downloads)
26
5eed6534 »
2012-06-27 add positive collection cropping code
27 ## Specifics
0131b7cc »
2012-05-21 initial kittydar with training
28
79acd48a »
2012-06-13 add sample images to demo, update readme
29 Kittydar takes a `canvas` element. In node you can get a `Canvas` object with [node-canvas](https://github.com/LearnBoost/node-canvas).
0131b7cc »
2012-05-21 initial kittydar with training
30
284efca0 »
2012-06-07 show progress in demo
31 Kittydar will give an approximate rectangle around the cat's head. Each rectangle has an `x` and `y` for the top left corner, and a `width` and `height` of the rectangle.
0131b7cc »
2012-05-21 initial kittydar with training
32
5eed6534 »
2012-06-27 add positive collection cropping code
33 ## How it works
0131b7cc »
2012-05-21 initial kittydar with training
34
79acd48a »
2012-06-13 add sample images to demo, update readme
35 Kittydar first chops the image up into many "windows" to test for the presence of a cat head. For each window, kittydar first extracts more tractable data from the image's data. Namely, it computes the [Histogram of Orient Gradients](http://en.wikipedia.org/wiki/Histogram_of_oriented_gradients) descriptor of the image, using the [hog-descriptor](http://github.com/harthur/hog-descriptor) library. This data describes the directions of the edges in the image (where the image changes from light to dark and vice versa) and what strength they are. This data is a vector of numbers that is then fed into a [neural network](https://github.com/harthur/brain) which gives a number from `0` to `1` on how likely the histogram data represents a cat.
0131b7cc »
2012-05-21 initial kittydar with training
36
37 The neural network (the JSON of which is located in this repo) has been pre-trained with thousands of photos of cat heads and their histograms, as well as thousands of non-cats. See the repo for the node training scripts.
284efca0 »
2012-06-07 show progress in demo
38
5eed6534 »
2012-06-27 add positive collection cropping code
39 ## Limitations
79acd48a »
2012-06-13 add sample images to demo, update readme
40
41 Kittydar will miss cats sometimes, and sometimes classify non-cats as cats. It's best at detecting upright cats that are facing forward, but it can handle a small tilt or turn in the head.
42
5eed6534 »
2012-06-27 add positive collection cropping code
43 Kittydar isn't fast. It'll take a few seconds to find the cats in one image.
79acd48a »
2012-06-13 add sample images to demo, update readme
44
5eed6534 »
2012-06-27 add positive collection cropping code
45 There's lots of room for improvement, so fork and send requests.
46
47 ## Propers
284efca0 »
2012-06-07 show progress in demo
48
0908268e »
2012-06-15 add brain and hog-descriptor to npm dependencies
49 * This informative reasearch paper: [Cat Head Detection - How to Effectively Exploit Shape and Texture Features](http://research.microsoft.com/pubs/80582/ECCV_CAT_PROC.pdf) by Weiwei Zhang, Jian Sun, and Xiaoou Tang.
5eed6534 »
2012-06-27 add positive collection cropping code
50
51 * This off the hook [dataset of cat images](http://137.189.35.203/WebUI/CatDatabase/catData.html) annotated with the locations of the cat's ears, eyes, and mouth.
52
177289d8 »
2012-06-10 fixing up overlap detection
53 * [@gdeglin](http://github.com/gdeglin) for the name.
Something went wrong with that request. Please try again.