Misc changes
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
f559e471ec
commit
8f99c05dca
@ -16,6 +16,9 @@ document.addEventListener("DOMContentLoaded", (event) => {
|
||||
var div = document.createElement("div");
|
||||
div.classList.add("face");
|
||||
div.style.backgroundImage = "url(face-data/" + (id % 100) + "/" + id + "-original.png)";
|
||||
div.addEventListener("click", (event) => {
|
||||
window.open("face-explorer.html?" + id, "photo-" + id);
|
||||
});
|
||||
document.body.appendChild(div);
|
||||
});
|
||||
});
|
||||
@ -36,5 +39,10 @@ body {
|
||||
display: inline-block;
|
||||
border: 1px solid black;
|
||||
margin: 0.5em;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.face:hover {
|
||||
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
</style>
|
||||
|
@ -6,6 +6,14 @@
|
||||
#include <math.h>
|
||||
#include <sqlite3.h>
|
||||
|
||||
#ifndef MIN_PTS
|
||||
#define MIN_PTS 20
|
||||
#endif
|
||||
|
||||
#ifndef MAX_DISTANCE
|
||||
#define MAX_DISTANCE 0.354667L
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
UNDEFINED = 0,
|
||||
CORE = 1,
|
||||
@ -270,7 +278,8 @@ int main(int argc, char *argv[]) {
|
||||
memset(ppFaces[i]->distances, 0, sizeof(*ppFaces[i]->distances) * entries);
|
||||
}
|
||||
|
||||
long int count = 0;
|
||||
long int processed = 0;
|
||||
int last = 0;
|
||||
for (i = 0; i < 100; i++) {
|
||||
sprintf(pathBuf, "%s/face-data/%ld", argv[1], i);
|
||||
DIR *faceDir = opendir(pathBuf);
|
||||
@ -281,7 +290,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
struct dirent *ent;
|
||||
while (count < entries && (ent = readdir(faceDir)) != NULL) {
|
||||
while (processed < entries && (ent = readdir(faceDir)) != NULL) {
|
||||
if (strstr(ent->d_name, ".json") == NULL) {
|
||||
continue;
|
||||
}
|
||||
@ -295,13 +304,17 @@ int main(int argc, char *argv[]) {
|
||||
char path[1028*2];
|
||||
sprintf(path, "%s/%s", pathBuf, ent->d_name);
|
||||
maxId = maxId > id ? maxId : id;
|
||||
if (!readFaceDescriptor(ppFaces[count], id, path)) {
|
||||
if (!readFaceDescriptor(ppFaces[processed], id, path)) {
|
||||
fprintf(stderr, "Unable to read %s.\n", path);
|
||||
continue;
|
||||
}
|
||||
count++;
|
||||
if (count % 1000 == 0) {
|
||||
fprintf(stderr, "Read %ld%% of descriptors.\n", (100 * count / entries));
|
||||
processed++;
|
||||
if (processed % 1000 == 0) {
|
||||
int perc = 100 * processed / (entries * entries);
|
||||
if (perc != last) {
|
||||
fprintf(stderr, "Read %d%% of descriptors.\n", perc);
|
||||
last = perc;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(faceDir);
|
||||
@ -309,15 +322,19 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
fprintf(stderr, "Read %ld face descriptors...\n", entries);
|
||||
|
||||
processed = 0;
|
||||
long double total = 0.0;
|
||||
long int processed = 0;
|
||||
for (long i = 0; i < entries; i++) {
|
||||
Face *pLink = ppFaces[i];
|
||||
for (long j = 0; j < entries; j++) {
|
||||
Face *pTarget = ppFaces[j];
|
||||
processed++;
|
||||
if (processed % 1000 == 0) {
|
||||
fprintf(stderr, "Computed %ld%% complete.\n", (100 * processed / (entries * entries)));
|
||||
int perc = 100 * processed / (entries * entries);
|
||||
if (perc != last) {
|
||||
fprintf(stderr, "Computed %d%% complete.\n", perc);
|
||||
last = perc;
|
||||
}
|
||||
}
|
||||
if (i == j) {
|
||||
pLink->distances[i] = 0.0;
|
||||
@ -338,7 +355,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
fprintf(stderr, "Average distance: %Lf\n", 1. * total / (entries * entries));
|
||||
|
||||
long int clusters = DBSCAN(ppFaces, entries, 0.44L, 2);
|
||||
long int clusters = DBSCAN(ppFaces, entries, MAX_DISTANCE, MIN_PTS);
|
||||
long int undefined = 0, outlier = 0, core = 0, reachable = 0;
|
||||
for (i = 0; i < entries; i++) {
|
||||
switch (ppFaces[i]->clusterType) {
|
||||
@ -418,6 +435,7 @@ int main(int argc, char *argv[]) {
|
||||
char sqlBuf[1024];
|
||||
|
||||
processed = 0;
|
||||
last = 0;
|
||||
for (long i = 0; i < entries; i++) {
|
||||
Face *pLink = ppFaces[i];
|
||||
for (long j = 0; j < entries; j++) {
|
||||
@ -425,7 +443,11 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
processed++;
|
||||
if (processed % 1000 == 0) {
|
||||
fprintf(stderr, "Computed %ld%% complete.\n", (100 * processed / (entries * entries)));
|
||||
int perc = 100 * processed / (entries * entries);
|
||||
if (perc != last) {
|
||||
fprintf(stderr, "Computed %d%% complete.\n", perc);
|
||||
last = perc;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == j) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user