Skip to content
Browse files

add failing todos list to testing

  • Loading branch information...
1 parent fb52de4 commit 268abc2049fccf408de2ca23264c5ede4e099f5c @harthur committed Nov 1, 2012
Showing with 66 additions and 25 deletions.
  1. +37 −25 testing/test.js
  2. +29 −0 testing/todos.js
View
62 testing/test.js
@@ -8,7 +8,8 @@ var fs = require("fs"),
charm = require("charm")(),
utils = require("../utils"),
nms = require("../nms"),
- kittydar = require("../kittydar");
+ kittydar = require("../kittydar"),
+ todos = require("./todos");
charm.pipe(process.stdout);
@@ -23,6 +24,8 @@ var truePos = 0;
var falsePos = 0;
var misses = [];
var finds = [];
+var newpasses = [];
+var newfails = [];
var results = [];
var total;
@@ -36,28 +39,43 @@ function runTest() {
var images = files.filter(function(file) {
return path.extname(file) == ".jpg";
- })
-
- images = images.slice(0, 4);
+ });
total = images.length;
+ console.log("running kittydar on " + total + " images");
printDots();
+
async.forEach(images, testImage, printResults);
});
}
function printResults() {
+ charm.cursor(true);
+
console.log("\n\ntrue positives: ", truePos);
console.log("false negatives: ", misses.length);
console.log("false positives: ", falsePos);
- console.log("\nfound:\n", finds);
- console.log("\nmisses:\n", misses);
+ if (newpasses.length) {
+ console.log("\nnew passes!".green);
+ for (var i = 0; i < newpasses.length; i++) {
+ console.log(newpasses[i]);
+ }
+ console.log("\n");
+ }
+
+ if (newfails.length) {
+ console.log("\nnew failures )=".red);
+ for (var i = 0; i < newfails.length; i++) {
+ console.log(newfails[i]);
+ }
+ console.log("\n");
+ }
}
-function testImage(file, callback) {
- file = opts.dir + file;
+function testImage(image, callback) {
+ var file = opts.dir + image;
fs.readFile(file + ".cat", "utf-8", function(err, text) {
if (err) throw err;
@@ -91,11 +109,19 @@ function testImage(file, callback) {
if (found) {
finds.push(file);
- results.push("pass")
+ results.push("pass");
+
+ if (todos.indexOf(image) >= 0) {
+ newpasses.push(file);
+ }
}
else {
misses.push(file);
results.push("fail");
+
+ if (todos.indexOf(image) == -1) {
+ newfails.push(file);
+ }
}
printDots();
@@ -123,23 +149,9 @@ function printDots() {
str += "·".grey;
}
charm.write(str);
- charm.down(1);
-}
-
-function saveCrop(canvas, cat, isTrue) {
- var cropCanvas = new Canvas(cat.width, cat.height);
- var ctx = cropCanvas.getContext('2d');
- ctx.patternQuality = "best";
- ctx.drawImage(canvas, cat.x, cat.y, cat.width, cat.height,
- 0, 0, cat.width, cat.height);
-
- var dir = __dirname + "/CROPS/" + (isTrue ? "/TRUE/" : "/FALSE/");
- var file = dir + cat.x + "_" + cat.y + "_" + cat.width
- + "_" + cat.prob.toFixed(2) + ".jpg"
- utils.writeCanvasToFile(cropCanvas, file, function(err) {
- if (err) console.log(err);
- });
+ // hide the cursor when printing the dots
+ charm.cursor(false);
}
function doesOverlap(cat, rect) {
View
29 testing/todos.js
@@ -0,0 +1,29 @@
+module.exports = [
+ '00092f6ec7a911e1be6a12313820455d_7.jpg', // too small
+ '0502a3b2a1e111e18cf91231380fd29b_7.jpg', // too small
+ '066bdac8c71811e1a38422000a1c8933_7.jpg', // too small
+ '25508c1e88ba11e1a87612313804ec91_7.jpg', // too small
+ '10b80642c7da11e19894123138140d8c_7.jpg', // not facing forward
+ '12a8d742be7f11e188131231381b5c25_7.jpg', // too small
+ '2320b0ae089e11e29e6f22000a1e8b8a_7.jpg', // too small
+ '33eb19201ed811e1abb01231381b65e3_7.jpg', // too small
+ '2f49bd8cbf0911e180d51231380fcd7e_7.jpg', // head tilted
+ '3437df14c7aa11e1aee522000a1e8a5f_7.jpg', // too small
+ '55d268706e7111e1989612313815112c_7.jpg', // not facing forward
+ '66250dd8be6011e1aebc1231381b647a_7.jpg', // --- should work
+ '5804b25e64d211e18bb812313804a181_7.jpg', // ears cut off
+ '5c7ac9ec6fa211e1a87612313804ec91_7.jpg', // ears cut off
+ '67dcb80ab41b11e1aebc1231381b647a_7.jpg', // not facing forward
+ '84592b6ebedc11e1989612313815112c_7.jpg', // too small
+ '90d35578a43711e180d51231380fcd7e_7.jpg', // too small
+ '7d7f0184a43711e1b10e123138105d6b_7.jpg', // too small
+ '8f496896661b11e180d51231380fcd7e_7.jpg', // not facing forward
+ '92df98b46efd11e18bb812313804a181_7.jpg', // not facing forward
+ 'a227324aa43711e19e4a12313813ffc0_7.jpg', // too small
+ 'bd9c8d0ea75711e1989612313815112c_7.jpg', // too small
+ 'b1d94ca0ca3911e18cf91231380fd29b_7.jpg', // ---- should work
+ 'b3f6a1ae359711e19e4a12313813ffc0_7.jpg', // too small, facing away
+ 'c47c1ca0ff4c11e1a76e22000a1e8903_7.jpg', // ears cut off
+ 'c9eead403a8c11e19e4a12313813ffc0_7.jpg', // ---- should work
+ 'e8f4da56d3c611e18ca012313806b840_7.jpg' // not facing forward
+ ];

0 comments on commit 268abc2

Please sign in to comment.
Something went wrong with that request. Please try again.