static double scoreColorPredicateByRect(F1 predicate, LPair testImages) { int score = 0, count = 0; for (Pair p : testImages) { RGBImage img = p.a; int w = img.getWidth(), h = img.getHeight(); //printStructs(+w, +h, r := p.b); for y to h: for x to w: { bool detected = callF(predicate, img.getInt(x, y)); bool real = rectContains(p.b, x, y); score += detected == real ? 1 : 0; } count += w*h; } ret doubleRatio(score, count); }