• This repository has been archived on 26/Sep/2023
  • Stars
    star
    1,415
  • Rank 31,898 (Top 0.7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 12 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Face detection for cats in JavaScript - demo for TXJS 2012 talk

Kittydar

Kittydar is short for kitty radar. Kittydar takes an image (canvas) and tells you the locations of all the cats in the image:

var cats = kittydar.detectCats(canvas);

console.log("there are", cats.length, "cats in this photo");

console.log(cats[0]);

// { x: 30, y: 200, width: 140, height: 140 }

Kittydar demo

Install

For node:

npm install kittydar

Or grab the browser file

Specifics

Kittydar takes a canvas element. In node you can get a Canvas object with node-canvas.

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.

How it works

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 descriptor of the image, using the 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 which gives a number from 0 to 1 on how likely the histogram data represents a cat.

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.

Limitations

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.

Kittydar isn't fast. It'll take a few seconds to find the cats in one image.

There's lots of room for improvement, so fork and send requests.

Propers

More Repositories

1

brain

Simple feed-forward neural network in JavaScript
JavaScript
8,005
star
2

replace

Command line search and replace utility
JavaScript
749
star
3

classifier

Bayesian classifier with Redis backend
JavaScript
626
star
4

clustering

K-means and hierarchical clustering
JavaScript
492
star
5

nomnom

Option parser for node with generated usage and commands
JavaScript
469
star
6

glossary

[UNMAINTAINED] Extract terms and keywords from a piece of text
JavaScript
168
star
7

hog-descriptor

[UNMAINTAINED] Histogram of Oriented Gradients (HOG) descriptor extractor
JavaScript
168
star
8

fxconsole

[UNMAINTAINED] Remote JavaScript console for Firefox
JavaScript
128
star
9

firefox-client

[UNMAINTAINED] Node.js remote debugging client for Firefox
JavaScript
101
star
10

costco

UI for bulk editing CouchDB docs
JavaScript
56
star
11

js-select

[UNMAINTAINED] Traverse and modify objects using JSONSelect selectors
JavaScript
56
star
12

rainbow

Color tools for Firefox
JavaScript
39
star
13

txjs-slides

dzslides deck for my txjs talk
CSS
14
star
14

mac-sounds

Play default OS X sounds from node
JavaScript
10
star
15

bzhome

Bugzilla dashboard
JavaScript
9
star
16

passion-project-slides

Slides for my Passion Projects talk on Machine Learning and JS
JavaScript
7
star
17

detect-indent

CSS
6
star
18

tcm

Mozilla's new testcase manager
JavaScript
5
star
19

searchbugs

Search for Bugzilla bugs by component
JavaScript
5
star
20

celestial-snips-app

Snips voice assistant that answers celestial questions
Python
3
star
21

mini-devtools

mini in-content devtools
JavaScript
3
star
22

test-pages

Testcase websites for devtools
JavaScript
3
star
23

artfulimage

The Artful Image fine printing
3
star
24

devtools-guide

3
star
25

showsearch

Jetpack that shows search terms in Firefox's awesomebar
JavaScript
3
star
26

firefontfamily

A Firebug extension that highlights the rendered font-family
JavaScript
2
star
27

contextfont

Firefox addon to find fonts on websites
JavaScript
2
star
28

bztweaks

mirror of Bugzilla Tweaks Firefox addon (https://bitbucket.org/ehsan/bugzilla-tweaks)
JavaScript
2
star
29

fluent-talk

JavaScript
1
star
30

bugidhelper

Bugzilla bug id linkifier and tooltipifier extension
JavaScript
1
star
31

brooklynjs-slides

Write your own in-content devtools with web APIs
CSS
1
star
32

test-snips-calc

Test Snips Calc Action
Python
1
star
33

harth

harth's no.de code
1
star
34

wwcode

A small website for Women Who Code SF
JavaScript
1
star
35

celestial-jupyter

Jupyter Notebook
1
star
36

test.js

Whatever's in my ~/test.js
JavaScript
1
star