exception handling

pull/39/head
Vladimir Mandic 2021-02-20 21:00:16 -05:00
parent 586dcdf477
commit 15d0176596
16 changed files with 38 additions and 37 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -634,7 +634,7 @@
] ]
}, },
"src/dom/extractFaces.ts": { "src/dom/extractFaces.ts": {
"bytes": 1782, "bytes": 1808,
"imports": [ "imports": [
{ {
"path": "src/classes/FaceDetection.ts", "path": "src/classes/FaceDetection.ts",
@ -2591,7 +2591,7 @@
"imports": [], "imports": [],
"exports": [], "exports": [],
"inputs": {}, "inputs": {},
"bytes": 309774 "bytes": 309815
}, },
"dist/face-api.esm-nobundle.js": { "dist/face-api.esm-nobundle.js": {
"imports": [], "imports": [],
@ -2872,7 +2872,7 @@
"bytesInOutput": 773 "bytesInOutput": 773
}, },
"src/dom/extractFaces.ts": { "src/dom/extractFaces.ts": {
"bytesInOutput": 475 "bytesInOutput": 489
}, },
"src/dom/extractFaceTensors.ts": { "src/dom/extractFaceTensors.ts": {
"bytesInOutput": 442 "bytesInOutput": 442
@ -3187,7 +3187,7 @@
"bytesInOutput": 443 "bytesInOutput": 443
} }
}, },
"bytes": 82164 "bytes": 82178
} }
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -634,7 +634,7 @@
] ]
}, },
"src/dom/extractFaces.ts": { "src/dom/extractFaces.ts": {
"bytes": 1782, "bytes": 1808,
"imports": [ "imports": [
{ {
"path": "src/classes/FaceDetection.ts", "path": "src/classes/FaceDetection.ts",
@ -2591,7 +2591,7 @@
"imports": [], "imports": [],
"exports": [], "exports": [],
"inputs": {}, "inputs": {},
"bytes": 1447733 "bytes": 1447774
}, },
"dist/face-api.esm.js": { "dist/face-api.esm.js": {
"imports": [], "imports": [],
@ -2866,7 +2866,7 @@
"bytesInOutput": 776 "bytesInOutput": 776
}, },
"src/dom/extractFaces.ts": { "src/dom/extractFaces.ts": {
"bytesInOutput": 480 "bytesInOutput": 494
}, },
"src/dom/extractFaceTensors.ts": { "src/dom/extractFaceTensors.ts": {
"bytesInOutput": 418 "bytesInOutput": 418
@ -3187,7 +3187,7 @@
"bytesInOutput": 446 "bytesInOutput": 446
} }
}, },
"bytes": 1134626 "bytes": 1134640
} }
} }
} }

2
dist/face-api.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

8
dist/face-api.json vendored
View File

@ -634,7 +634,7 @@
] ]
}, },
"src/dom/extractFaces.ts": { "src/dom/extractFaces.ts": {
"bytes": 1782, "bytes": 1808,
"imports": [ "imports": [
{ {
"path": "src/classes/FaceDetection.ts", "path": "src/classes/FaceDetection.ts",
@ -2591,7 +2591,7 @@
"imports": [], "imports": [],
"exports": [], "exports": [],
"inputs": {}, "inputs": {},
"bytes": 1447740 "bytes": 1447781
}, },
"dist/face-api.js": { "dist/face-api.js": {
"imports": [], "imports": [],
@ -2748,7 +2748,7 @@
"bytesInOutput": 776 "bytesInOutput": 776
}, },
"src/dom/extractFaces.ts": { "src/dom/extractFaces.ts": {
"bytesInOutput": 480 "bytesInOutput": 494
}, },
"src/dom/extractFaceTensors.ts": { "src/dom/extractFaceTensors.ts": {
"bytesInOutput": 418 "bytesInOutput": 418
@ -3066,7 +3066,7 @@
"bytesInOutput": 446 "bytesInOutput": 446
} }
}, },
"bytes": 1134789 "bytes": 1134803
} }
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -634,7 +634,7 @@
] ]
}, },
"src/dom/extractFaces.ts": { "src/dom/extractFaces.ts": {
"bytes": 1782, "bytes": 1808,
"imports": [ "imports": [
{ {
"path": "src/classes/FaceDetection.ts", "path": "src/classes/FaceDetection.ts",
@ -2591,7 +2591,7 @@
"imports": [], "imports": [],
"exports": [], "exports": [],
"inputs": {}, "inputs": {},
"bytes": 309659 "bytes": 309700
}, },
"dist/face-api.node-gpu.js": { "dist/face-api.node-gpu.js": {
"imports": [], "imports": [],
@ -2751,7 +2751,7 @@
"bytesInOutput": 773 "bytesInOutput": 773
}, },
"src/dom/extractFaces.ts": { "src/dom/extractFaces.ts": {
"bytesInOutput": 475 "bytesInOutput": 489
}, },
"src/dom/extractFaceTensors.ts": { "src/dom/extractFaceTensors.ts": {
"bytesInOutput": 442 "bytesInOutput": 442
@ -3066,7 +3066,7 @@
"bytesInOutput": 443 "bytesInOutput": 443
} }
}, },
"bytes": 82707 "bytes": 82721
} }
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -634,7 +634,7 @@
] ]
}, },
"src/dom/extractFaces.ts": { "src/dom/extractFaces.ts": {
"bytes": 1782, "bytes": 1808,
"imports": [ "imports": [
{ {
"path": "src/classes/FaceDetection.ts", "path": "src/classes/FaceDetection.ts",
@ -2591,7 +2591,7 @@
"imports": [], "imports": [],
"exports": [], "exports": [],
"inputs": {}, "inputs": {},
"bytes": 309651 "bytes": 309692
}, },
"dist/face-api.node.js": { "dist/face-api.node.js": {
"imports": [], "imports": [],
@ -2751,7 +2751,7 @@
"bytesInOutput": 773 "bytesInOutput": 773
}, },
"src/dom/extractFaces.ts": { "src/dom/extractFaces.ts": {
"bytesInOutput": 475 "bytesInOutput": 489
}, },
"src/dom/extractFaceTensors.ts": { "src/dom/extractFaceTensors.ts": {
"bytesInOutput": 442 "bytesInOutput": 442
@ -3066,7 +3066,7 @@
"bytesInOutput": 443 "bytesInOutput": 443
} }
}, },
"bytes": 82699 "bytes": 82713
} }
} }
} }

View File

@ -47,8 +47,9 @@ export async function extractFaces(
x, y, width, height, x, y, width, height,
}) => { }) => {
const faceImg = createCanvas({ width, height }); const faceImg = createCanvas({ width, height });
getContext2dOrThrow(faceImg) try {
.putImageData(ctx.getImageData(x, y, width, height), 0, 0); getContext2dOrThrow(faceImg).putImageData(ctx.getImageData(x, y, width, height), 0, 0);
} catch { /**/ }
return faceImg; return faceImg;
}); });
} }