Warning: session_start(): open(/var/lib/php/sessions/sess_972243rpij068b5r5m35o2k6mo, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
sclass Entry {
RGB color;
double maxDistance;
}
cmodule LearnActiveTab > DynSingleFunctionWithPrintLog {
void doIt {
LPair data = gatherMarkedThingInImages(listImageFiles(
//ai_browserTabsTrainingDataDir()
aiImageAlbumDir()
), "Active tab");
pnlStruct(data);
int gridSize = 4;
new LPair scaledImages;
for (Pair p : data) {
BufferedImage img = loadImage2(p.a);
RGBImage rgb = RGBImage(scaleImageWithFactor(1.0/gridSize, img));
//showImage(rgb);
add(scaledImages, pair(rgb, scaleRect(p.b, 1.0/gridSize)));
}
RandomAndVary_Record rav = new(Entry,
color := new RandomAndVary_RGB,
maxDistance := new RandomAndVary_Double);
Entry e = rav.randomInstance();
print(e);
int score = 0, count = 0;
for (Pair p : scaledImages) {
RGBImage img = p.a;
int w = img.getWidth(), h = img.getHeight();
for y to h:
for x to w: {
bool detected = rgbDistance(img.getPixel(x, y), e.color) <= e.maxDistance;
bool real = rectContains(p.b, x, y);
score += detected == real ? 1 : 0;
}
count += w*h;
}
print("Score: " + doubleRatio(score, count));
}
}