Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

allow test images with no cats for false positive testing

  • Loading branch information...
commit 653fd792784d94f04b076a43f8af11c907161dba 1 parent 5009c25
@harthur authored
Showing with 15 additions and 9 deletions.
  1. +15 −9 testing/test.js
View
24 testing/test.js
@@ -85,14 +85,17 @@ function testImage(image, callback) {
var vals = text.split(" ").map(function(val) {
return parseInt(val)
- })
+ });
- var rect = {
- x: vals[0],
- y: vals[1],
- width: vals[2],
- height: vals[3]
- };
+ var rect;
+ if (vals.length >= 4) {
+ rect = {
+ x: vals[0],
+ y: vals[1],
+ width: vals[2],
+ height: vals[3]
+ };
+ }
utils.drawImgToCanvas(file, function(err, canvas) {
// todo: detect time
@@ -104,7 +107,10 @@ function testImage(image, callback) {
var found = false;
cats.forEach(function(cat) {
- var overlaps = nms.doesOverlap(cat, rect);
+ var overlaps = false;
+ if (rect) {
+ overlaps = nms.doesOverlap(cat, rect);
+ }
if (overlaps) {
found = true;
truePos++;
@@ -121,7 +127,7 @@ function testImage(image, callback) {
newpasses.push(file);
}
}
- else {
+ else if (rect) {
misses.push(file);
results.push("fail");
Please sign in to comment.
Something went wrong with that request. Please try again.