-
Notifications
You must be signed in to change notification settings - Fork 0
/
FACEDETECTION AND DATABASE SCRIPTS.js
130 lines (104 loc) · 3.22 KB
/
FACEDETECTION AND DATABASE SCRIPTS.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
const { exec } = require("child_process");
var x = 1;
function deletelib(libname){
exec("aws2 rekognition delete-collection \
--collection-id \""+libname+"\"", (error, stdout, stderr) => {
console.log("Deleting Old Collection..." + libname)
console.log(stdout)
});
}
function newlib(libname){
exec("aws2 rekognition create-collection \
--collection-id \""+libname +"\"", (error, stdout, stderr) => {
console.log("Made new Collection!..." + libname)
console.log(stdout)
});
}
function thingout(libname){
exec("aws2 rekognition list-faces \
--collection-id 'ass'", (error, stdout, stderr) => {
console.log("Printing Out thing...")
console.log(`stdout: ${stdout}`)
});
}
function addperson(img, id){
exec("aws2 rekognition index-faces \
--image '{\"S3Object\":{\"Bucket\":\"image1213\",\"Name\":\""+img+"\"}}' \
--collection-id \"ass\" \
--max-faces 1 \
--quality-filter \"AUTO\" \
--detection-attributes \"ALL\" \
--external-image-id "+ id, (error, stdout, stderr) => {
console.log("Added Person: " + id +", With path \"" +img +"\"");
});
}
function foundq(string){
console.log("SUCK PP");
}
function phototake(name){
deletelib("ass");
setTimeout(function () {
newlib("ass");
}, 2000);
setTimeout(function () {
thingout("nah");
}, 4000);
setTimeout(function () {
addperson("elon1.jpeg", "e1");
}, 6000);
setTimeout(function () {
addperson("elon2.jpeg", "e2");
}, 6000);
setTimeout(function () {
addperson("gram1.jpg", "g1");
}, 6000);
setTimeout(function () {
thingout("nah");
}, 13000);
}
function mostlike(img){
exec("aws2 rekognition search-faces-by-image \
--image '{\"S3Object\":{\"Bucket\":\"image1213\",\"Name\":\""+ img +"\"}}' \
--collection-id \"ass\"", (error, stdout, stderr) => {
foundq(stdout);
});
}
if (x == 0){
exec("aws2 rekognition create-collection \
--collection-id 'new'", (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}
console.log(`stdout: ${stdout}`);
});
} else if (x == 2){
exec("aws2 rekognition search-faces-by-image \
--image '{\"S3Object\":{\"Bucket\":\"image1213\",\"Name\":\"IMG_6039.jpg\"}}' \
--collection-id \"shit\"", (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}
console.log(`stdout: ${stdout}`);
});
} else if (x == 3){
var namen = "robbie";
exec("aws2 rekognition index-faces \
--image '{\"S3Object\":{\"Bucket\":\"image1213\",\"Name\":\"a.jpg\"}}' \
--collection-id \"ass\" \
--max-faces 1 \
--quality-filter \"AUTO\" \
--detection-attributes \"ALL\" \
--external-image-id "+ namen, (error, thing, stderr) => {
});
}
mostlike("k.jpg");