Warning: session_start(): open(/var/lib/php/sessions/sess_aco8qu0hvvcc40oenv8tp137de, 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
sclass FaceDataSet {
S csvSnippetID = #1032472;
class Entry {
S imageURL;
File imageFile;
DoubleRect facePosition;
}
L entries;
File imagesDir() { ret javaxCachesDir("Google Face Data Set"); }
File downloadImage(S url) {
File file = newFile(imagesDir(), md5FileName(url) + fileExtension(url));
if (!file.exists())
loadBinaryPageToFile(url, file);
ret file;
}
void load {
for (LS row : parseExtendedCSV_iterator(loadSnippet(csvSnippetID))) {
int i = 0;
for n to 3: {
new Entry e;
e.imageURL = row.get(i++);
e.imageFile = downloadImage(e.imageURL);
e.facePosition = doubleRectFromPoints(
parseDouble(row.get(i)), // left column (x1)
parseDouble(row.get(i+2)), // top row (y1)
parseDouble(row.get(i+1)), // right column (x2)
parseDouble(row.get(i+3)), // bottom row (y2)
);
entries.add(e);
i += 4;
}
}
print("Have " + nEntries(entries));
}
}
/* Row begins:
URL of image1 (string)
Top-left column of the face bounding box in image1 normalized by width (float)
Bottom-right column of the face bounding box in image1 normalized by width (float)
Top-left row of the face bounding box in image1 normalized by height (float)
Bottom-right row of the face bounding box in image1 normalized by height (float)
*/