added faceapi.version object
parent
987912e69a
commit
85006365c1
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@vladmandic/face-api",
|
"name": "@vladmandic/face-api",
|
||||||
"version": "0.4.6",
|
"version": "0.5.1",
|
||||||
"description": "JavaScript module for Face Detection and Face Recognition Using Tensorflow/JS",
|
"description": "JavaScript module for Face Detection and Face Recognition Using Tensorflow/JS",
|
||||||
"main": "dist/face-api.cjs",
|
"main": "dist/face-api.cjs",
|
||||||
"module": "dist/face-api.ejs",
|
"module": "dist/face-api.ejs",
|
||||||
|
|
|
@ -20,7 +20,9 @@ export * from './NeuralNetwork';
|
||||||
export * from './resizeResults';
|
export * from './resizeResults';
|
||||||
export declare const version: {
|
export declare const version: {
|
||||||
faceapi: string;
|
faceapi: string;
|
||||||
tfjs_core: string;
|
node: string | boolean;
|
||||||
env: import("@tensorflow/tfjs-core/dist/environment").Flags;
|
browser: string | boolean;
|
||||||
|
tfjs: string;
|
||||||
|
backend: string;
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=index.d.ts.map
|
//# sourceMappingURL=index.d.ts.map
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAE3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAGhC,eAAO,MAAM,OAAO;;;;CAA+E,CAAC"}
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAE3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAKhC,eAAO,MAAM,OAAO;;;;;;CAA2F,CAAC"}
|
|
@ -1,3 +1,5 @@
|
||||||
|
// const os = require('os');
|
||||||
|
// const process = require('process');
|
||||||
import * as tf from '@tensorflow/tfjs-core';
|
import * as tf from '@tensorflow/tfjs-core';
|
||||||
import * as draw from './draw';
|
import * as draw from './draw';
|
||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
|
@ -19,5 +21,7 @@ export * from './euclideanDistance';
|
||||||
export * from './NeuralNetwork';
|
export * from './NeuralNetwork';
|
||||||
export * from './resizeResults';
|
export * from './resizeResults';
|
||||||
import * as pkg from '../package.json';
|
import * as pkg from '../package.json';
|
||||||
export const version = { faceapi: pkg.version, tfjs_core: tf.version_core, env: tf.ENV.getFlags() };
|
const node = typeof process !== 'undefined' ? process.version : false;
|
||||||
|
const browser = typeof navigator !== 'undefined' ? navigator.userAgent : false;
|
||||||
|
export const version = { faceapi: pkg.version, node, browser, tfjs: tf.version_core, backend: tf.getBackend() };
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAE3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAEhC,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AACvC,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC"}
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,sCAAsC;AAEtC,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAE3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAEhC,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AACvC,MAAM,IAAI,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAA;AACrE,MAAM,OAAO,GAAG,OAAO,SAAS,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAA;AAC9E,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,YAAY,EAAE,OAAO,EAAE,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC"}
|
|
@ -627,7 +627,7 @@ var require_seedrandom = __commonJS((exports2, module2) => {
|
||||||
}
|
}
|
||||||
return tostring(out);
|
return tostring(out);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
var browser = global2.navigator, plugins = browser && browser.plugins;
|
var browser2 = global2.navigator, plugins = browser2 && browser2.plugins;
|
||||||
return [+new Date(), global2, plugins, global2.screen, tostring(pool3)];
|
return [+new Date(), global2, plugins, global2.screen, tostring(pool3)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1744,16 +1744,16 @@ function getFilteredNodesXToY(tape2, xs, y) {
|
||||||
tensorsFromX[xs[i].id] = true;
|
tensorsFromX[xs[i].id] = true;
|
||||||
}
|
}
|
||||||
for (let i = 0; i < tape2.length; i++) {
|
for (let i = 0; i < tape2.length; i++) {
|
||||||
const node = tape2[i];
|
const node2 = tape2[i];
|
||||||
const nodeInputs = node.inputs;
|
const nodeInputs = node2.inputs;
|
||||||
for (const inputName in nodeInputs) {
|
for (const inputName in nodeInputs) {
|
||||||
const input = nodeInputs[inputName];
|
const input = nodeInputs[inputName];
|
||||||
let anyInputFromX = false;
|
let anyInputFromX = false;
|
||||||
for (let j = 0; j < xs.length; j++) {
|
for (let j = 0; j < xs.length; j++) {
|
||||||
if (tensorsFromX[input.id]) {
|
if (tensorsFromX[input.id]) {
|
||||||
node.outputs.forEach((output) => tensorsFromX[output.id] = true);
|
node2.outputs.forEach((output) => tensorsFromX[output.id] = true);
|
||||||
anyInputFromX = true;
|
anyInputFromX = true;
|
||||||
nodesFromX[node.id] = true;
|
nodesFromX[node2.id] = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1766,13 +1766,13 @@ function getFilteredNodesXToY(tape2, xs, y) {
|
||||||
tensorsLeadToY[y.id] = true;
|
tensorsLeadToY[y.id] = true;
|
||||||
const nodesToY = {};
|
const nodesToY = {};
|
||||||
for (let i = tape2.length - 1; i >= 0; i--) {
|
for (let i = tape2.length - 1; i >= 0; i--) {
|
||||||
const node = tape2[i];
|
const node2 = tape2[i];
|
||||||
const nodeInputs = node.inputs;
|
const nodeInputs = node2.inputs;
|
||||||
for (let j = 0; j < node.outputs.length; j++) {
|
for (let j = 0; j < node2.outputs.length; j++) {
|
||||||
if (tensorsLeadToY[node.outputs[j].id]) {
|
if (tensorsLeadToY[node2.outputs[j].id]) {
|
||||||
for (const inputName in nodeInputs) {
|
for (const inputName in nodeInputs) {
|
||||||
tensorsLeadToY[nodeInputs[inputName].id] = true;
|
tensorsLeadToY[nodeInputs[inputName].id] = true;
|
||||||
nodesToY[node.id] = true;
|
nodesToY[node2.id] = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1780,18 +1780,18 @@ function getFilteredNodesXToY(tape2, xs, y) {
|
||||||
}
|
}
|
||||||
const filteredTape = [];
|
const filteredTape = [];
|
||||||
for (let i = 0; i < tape2.length; i++) {
|
for (let i = 0; i < tape2.length; i++) {
|
||||||
const node = tape2[i];
|
const node2 = tape2[i];
|
||||||
if (nodesFromX[node.id] && nodesToY[node.id]) {
|
if (nodesFromX[node2.id] && nodesToY[node2.id]) {
|
||||||
const prunedInputs = {};
|
const prunedInputs = {};
|
||||||
for (const inputName in node.inputs) {
|
for (const inputName in node2.inputs) {
|
||||||
const nodeInput = node.inputs[inputName];
|
const nodeInput = node2.inputs[inputName];
|
||||||
if (tensorsFromX[nodeInput.id]) {
|
if (tensorsFromX[nodeInput.id]) {
|
||||||
prunedInputs[inputName] = nodeInput;
|
prunedInputs[inputName] = nodeInput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const prunedNode = Object.assign({}, node);
|
const prunedNode = Object.assign({}, node2);
|
||||||
prunedNode.inputs = prunedInputs;
|
prunedNode.inputs = prunedInputs;
|
||||||
prunedNode.outputs = node.outputs;
|
prunedNode.outputs = node2.outputs;
|
||||||
filteredTape.push(prunedNode);
|
filteredTape.push(prunedNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1799,9 +1799,9 @@ function getFilteredNodesXToY(tape2, xs, y) {
|
||||||
}
|
}
|
||||||
function backpropagateGradients(tensorAccumulatedGradientMap, filteredTape, tidy2, add29) {
|
function backpropagateGradients(tensorAccumulatedGradientMap, filteredTape, tidy2, add29) {
|
||||||
for (let i = filteredTape.length - 1; i >= 0; i--) {
|
for (let i = filteredTape.length - 1; i >= 0; i--) {
|
||||||
const node = filteredTape[i];
|
const node2 = filteredTape[i];
|
||||||
const dys = [];
|
const dys = [];
|
||||||
node.outputs.forEach((o) => {
|
node2.outputs.forEach((o) => {
|
||||||
const gradTensor = tensorAccumulatedGradientMap[o.id];
|
const gradTensor = tensorAccumulatedGradientMap[o.id];
|
||||||
if (gradTensor != null) {
|
if (gradTensor != null) {
|
||||||
dys.push(gradTensor);
|
dys.push(gradTensor);
|
||||||
|
@ -1809,21 +1809,21 @@ function backpropagateGradients(tensorAccumulatedGradientMap, filteredTape, tidy
|
||||||
dys.push(null);
|
dys.push(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (node.gradient == null) {
|
if (node2.gradient == null) {
|
||||||
throw new Error(`Cannot compute gradient: gradient function not found for ${node.kernelName}.`);
|
throw new Error(`Cannot compute gradient: gradient function not found for ${node2.kernelName}.`);
|
||||||
}
|
}
|
||||||
const inputGradients = node.gradient(dys);
|
const inputGradients = node2.gradient(dys);
|
||||||
for (const inputName in node.inputs) {
|
for (const inputName in node2.inputs) {
|
||||||
if (!(inputName in inputGradients)) {
|
if (!(inputName in inputGradients)) {
|
||||||
throw new Error(`Cannot backprop through input ${inputName}. Available gradients found: ${Object.keys(inputGradients)}.`);
|
throw new Error(`Cannot backprop through input ${inputName}. Available gradients found: ${Object.keys(inputGradients)}.`);
|
||||||
}
|
}
|
||||||
const dx = tidy2(() => inputGradients[inputName]());
|
const dx = tidy2(() => inputGradients[inputName]());
|
||||||
if (dx.dtype !== "float32") {
|
if (dx.dtype !== "float32") {
|
||||||
throw new Error(`Error in gradient for op ${node.kernelName}. The gradient of input ${inputName} must have 'float32' dtype, but has '${dx.dtype}'`);
|
throw new Error(`Error in gradient for op ${node2.kernelName}. The gradient of input ${inputName} must have 'float32' dtype, but has '${dx.dtype}'`);
|
||||||
}
|
}
|
||||||
const x = node.inputs[inputName];
|
const x = node2.inputs[inputName];
|
||||||
if (!arraysEqual(dx.shape, x.shape)) {
|
if (!arraysEqual(dx.shape, x.shape)) {
|
||||||
throw new Error(`Error in gradient for op ${node.kernelName}. The gradient of input '${inputName}' has shape '${dx.shape}', which does not match the shape of the input '${x.shape}'`);
|
throw new Error(`Error in gradient for op ${node2.kernelName}. The gradient of input '${inputName}' has shape '${dx.shape}', which does not match the shape of the input '${x.shape}'`);
|
||||||
}
|
}
|
||||||
if (tensorAccumulatedGradientMap[x.id] == null) {
|
if (tensorAccumulatedGradientMap[x.id] == null) {
|
||||||
tensorAccumulatedGradientMap[x.id] = dx;
|
tensorAccumulatedGradientMap[x.id] = dx;
|
||||||
|
@ -2977,8 +2977,8 @@ class Engine {
|
||||||
backpropagateGradients(accumulatedGradientMap, filteredTape, (f2) => this.tidy(f2), add);
|
backpropagateGradients(accumulatedGradientMap, filteredTape, (f2) => this.tidy(f2), add);
|
||||||
const grads2 = xs.map((x) => accumulatedGradientMap[x.id]);
|
const grads2 = xs.map((x) => accumulatedGradientMap[x.id]);
|
||||||
if (this.state.gradientDepth === 0) {
|
if (this.state.gradientDepth === 0) {
|
||||||
this.state.activeTape.forEach((node) => {
|
this.state.activeTape.forEach((node2) => {
|
||||||
for (const tensor17 of node.saved) {
|
for (const tensor17 of node2.saved) {
|
||||||
tensor17.dispose();
|
tensor17.dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -24254,7 +24254,7 @@ function resizeResults(results, dimensions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// build/package.json
|
// build/package.json
|
||||||
var version2 = "0.4.6";
|
var version2 = "0.5.1";
|
||||||
|
|
||||||
// build/src/index.js
|
// build/src/index.js
|
||||||
__export(exports, {
|
__export(exports, {
|
||||||
|
@ -24380,5 +24380,7 @@ __export(exports, {
|
||||||
validateConfig: () => validateConfig,
|
validateConfig: () => validateConfig,
|
||||||
version: () => version3
|
version: () => version3
|
||||||
});
|
});
|
||||||
const version3 = {faceapi: version2, tfjs_core: version, env: ENV.getFlags()};
|
const node = typeof process !== "undefined" ? process.version : false;
|
||||||
|
const browser = typeof navigator !== "undefined" ? navigator.userAgent : false;
|
||||||
|
const version3 = {faceapi: version2, node, browser, tfjs: version, backend: getBackend()};
|
||||||
//# sourceMappingURL=face-api.cjs.map
|
//# sourceMappingURL=face-api.cjs.map
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -631,7 +631,7 @@ var require_seedrandom = __commonJS((exports, module) => {
|
||||||
}
|
}
|
||||||
return tostring(out);
|
return tostring(out);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
var browser = global2.navigator, plugins = browser && browser.plugins;
|
var browser2 = global2.navigator, plugins = browser2 && browser2.plugins;
|
||||||
return [+new Date(), global2, plugins, global2.screen, tostring(pool3)];
|
return [+new Date(), global2, plugins, global2.screen, tostring(pool3)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1748,16 +1748,16 @@ function getFilteredNodesXToY(tape2, xs, y) {
|
||||||
tensorsFromX[xs[i].id] = true;
|
tensorsFromX[xs[i].id] = true;
|
||||||
}
|
}
|
||||||
for (let i = 0; i < tape2.length; i++) {
|
for (let i = 0; i < tape2.length; i++) {
|
||||||
const node = tape2[i];
|
const node2 = tape2[i];
|
||||||
const nodeInputs = node.inputs;
|
const nodeInputs = node2.inputs;
|
||||||
for (const inputName in nodeInputs) {
|
for (const inputName in nodeInputs) {
|
||||||
const input = nodeInputs[inputName];
|
const input = nodeInputs[inputName];
|
||||||
let anyInputFromX = false;
|
let anyInputFromX = false;
|
||||||
for (let j = 0; j < xs.length; j++) {
|
for (let j = 0; j < xs.length; j++) {
|
||||||
if (tensorsFromX[input.id]) {
|
if (tensorsFromX[input.id]) {
|
||||||
node.outputs.forEach((output) => tensorsFromX[output.id] = true);
|
node2.outputs.forEach((output) => tensorsFromX[output.id] = true);
|
||||||
anyInputFromX = true;
|
anyInputFromX = true;
|
||||||
nodesFromX[node.id] = true;
|
nodesFromX[node2.id] = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1770,13 +1770,13 @@ function getFilteredNodesXToY(tape2, xs, y) {
|
||||||
tensorsLeadToY[y.id] = true;
|
tensorsLeadToY[y.id] = true;
|
||||||
const nodesToY = {};
|
const nodesToY = {};
|
||||||
for (let i = tape2.length - 1; i >= 0; i--) {
|
for (let i = tape2.length - 1; i >= 0; i--) {
|
||||||
const node = tape2[i];
|
const node2 = tape2[i];
|
||||||
const nodeInputs = node.inputs;
|
const nodeInputs = node2.inputs;
|
||||||
for (let j = 0; j < node.outputs.length; j++) {
|
for (let j = 0; j < node2.outputs.length; j++) {
|
||||||
if (tensorsLeadToY[node.outputs[j].id]) {
|
if (tensorsLeadToY[node2.outputs[j].id]) {
|
||||||
for (const inputName in nodeInputs) {
|
for (const inputName in nodeInputs) {
|
||||||
tensorsLeadToY[nodeInputs[inputName].id] = true;
|
tensorsLeadToY[nodeInputs[inputName].id] = true;
|
||||||
nodesToY[node.id] = true;
|
nodesToY[node2.id] = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1784,18 +1784,18 @@ function getFilteredNodesXToY(tape2, xs, y) {
|
||||||
}
|
}
|
||||||
const filteredTape = [];
|
const filteredTape = [];
|
||||||
for (let i = 0; i < tape2.length; i++) {
|
for (let i = 0; i < tape2.length; i++) {
|
||||||
const node = tape2[i];
|
const node2 = tape2[i];
|
||||||
if (nodesFromX[node.id] && nodesToY[node.id]) {
|
if (nodesFromX[node2.id] && nodesToY[node2.id]) {
|
||||||
const prunedInputs = {};
|
const prunedInputs = {};
|
||||||
for (const inputName in node.inputs) {
|
for (const inputName in node2.inputs) {
|
||||||
const nodeInput = node.inputs[inputName];
|
const nodeInput = node2.inputs[inputName];
|
||||||
if (tensorsFromX[nodeInput.id]) {
|
if (tensorsFromX[nodeInput.id]) {
|
||||||
prunedInputs[inputName] = nodeInput;
|
prunedInputs[inputName] = nodeInput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const prunedNode = Object.assign({}, node);
|
const prunedNode = Object.assign({}, node2);
|
||||||
prunedNode.inputs = prunedInputs;
|
prunedNode.inputs = prunedInputs;
|
||||||
prunedNode.outputs = node.outputs;
|
prunedNode.outputs = node2.outputs;
|
||||||
filteredTape.push(prunedNode);
|
filteredTape.push(prunedNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1803,9 +1803,9 @@ function getFilteredNodesXToY(tape2, xs, y) {
|
||||||
}
|
}
|
||||||
function backpropagateGradients(tensorAccumulatedGradientMap, filteredTape, tidy2, add29) {
|
function backpropagateGradients(tensorAccumulatedGradientMap, filteredTape, tidy2, add29) {
|
||||||
for (let i = filteredTape.length - 1; i >= 0; i--) {
|
for (let i = filteredTape.length - 1; i >= 0; i--) {
|
||||||
const node = filteredTape[i];
|
const node2 = filteredTape[i];
|
||||||
const dys = [];
|
const dys = [];
|
||||||
node.outputs.forEach((o) => {
|
node2.outputs.forEach((o) => {
|
||||||
const gradTensor = tensorAccumulatedGradientMap[o.id];
|
const gradTensor = tensorAccumulatedGradientMap[o.id];
|
||||||
if (gradTensor != null) {
|
if (gradTensor != null) {
|
||||||
dys.push(gradTensor);
|
dys.push(gradTensor);
|
||||||
|
@ -1813,21 +1813,21 @@ function backpropagateGradients(tensorAccumulatedGradientMap, filteredTape, tidy
|
||||||
dys.push(null);
|
dys.push(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (node.gradient == null) {
|
if (node2.gradient == null) {
|
||||||
throw new Error(`Cannot compute gradient: gradient function not found for ${node.kernelName}.`);
|
throw new Error(`Cannot compute gradient: gradient function not found for ${node2.kernelName}.`);
|
||||||
}
|
}
|
||||||
const inputGradients = node.gradient(dys);
|
const inputGradients = node2.gradient(dys);
|
||||||
for (const inputName in node.inputs) {
|
for (const inputName in node2.inputs) {
|
||||||
if (!(inputName in inputGradients)) {
|
if (!(inputName in inputGradients)) {
|
||||||
throw new Error(`Cannot backprop through input ${inputName}. Available gradients found: ${Object.keys(inputGradients)}.`);
|
throw new Error(`Cannot backprop through input ${inputName}. Available gradients found: ${Object.keys(inputGradients)}.`);
|
||||||
}
|
}
|
||||||
const dx = tidy2(() => inputGradients[inputName]());
|
const dx = tidy2(() => inputGradients[inputName]());
|
||||||
if (dx.dtype !== "float32") {
|
if (dx.dtype !== "float32") {
|
||||||
throw new Error(`Error in gradient for op ${node.kernelName}. The gradient of input ${inputName} must have 'float32' dtype, but has '${dx.dtype}'`);
|
throw new Error(`Error in gradient for op ${node2.kernelName}. The gradient of input ${inputName} must have 'float32' dtype, but has '${dx.dtype}'`);
|
||||||
}
|
}
|
||||||
const x = node.inputs[inputName];
|
const x = node2.inputs[inputName];
|
||||||
if (!arraysEqual(dx.shape, x.shape)) {
|
if (!arraysEqual(dx.shape, x.shape)) {
|
||||||
throw new Error(`Error in gradient for op ${node.kernelName}. The gradient of input '${inputName}' has shape '${dx.shape}', which does not match the shape of the input '${x.shape}'`);
|
throw new Error(`Error in gradient for op ${node2.kernelName}. The gradient of input '${inputName}' has shape '${dx.shape}', which does not match the shape of the input '${x.shape}'`);
|
||||||
}
|
}
|
||||||
if (tensorAccumulatedGradientMap[x.id] == null) {
|
if (tensorAccumulatedGradientMap[x.id] == null) {
|
||||||
tensorAccumulatedGradientMap[x.id] = dx;
|
tensorAccumulatedGradientMap[x.id] = dx;
|
||||||
|
@ -2981,8 +2981,8 @@ class Engine {
|
||||||
backpropagateGradients(accumulatedGradientMap, filteredTape, (f2) => this.tidy(f2), add);
|
backpropagateGradients(accumulatedGradientMap, filteredTape, (f2) => this.tidy(f2), add);
|
||||||
const grads2 = xs.map((x) => accumulatedGradientMap[x.id]);
|
const grads2 = xs.map((x) => accumulatedGradientMap[x.id]);
|
||||||
if (this.state.gradientDepth === 0) {
|
if (this.state.gradientDepth === 0) {
|
||||||
this.state.activeTape.forEach((node) => {
|
this.state.activeTape.forEach((node2) => {
|
||||||
for (const tensor17 of node.saved) {
|
for (const tensor17 of node2.saved) {
|
||||||
tensor17.dispose();
|
tensor17.dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -24258,10 +24258,12 @@ function resizeResults(results, dimensions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// build/package.json
|
// build/package.json
|
||||||
var version2 = "0.4.6";
|
var version2 = "0.5.1";
|
||||||
|
|
||||||
// build/src/index.js
|
// build/src/index.js
|
||||||
const version3 = {faceapi: version2, tfjs_core: version, env: ENV.getFlags()};
|
const node = typeof process !== "undefined" ? process.version : false;
|
||||||
|
const browser = typeof navigator !== "undefined" ? navigator.userAgent : false;
|
||||||
|
const version3 = {faceapi: version2, node, browser, tfjs: version, backend: getBackend()};
|
||||||
export {
|
export {
|
||||||
AgeGenderNet,
|
AgeGenderNet,
|
||||||
BoundingBox,
|
BoundingBox,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -807,7 +807,9 @@ var faceapi = (() => {
|
||||||
validateConfig: () => validateConfig,
|
validateConfig: () => validateConfig,
|
||||||
version: () => version3
|
version: () => version3
|
||||||
});
|
});
|
||||||
const version3 = {faceapi: version2, tfjs_core: version, env: ENV.getFlags()};
|
const node = typeof process !== "undefined" ? process.version : false;
|
||||||
|
const browser = typeof navigator !== "undefined" ? navigator.userAgent : false;
|
||||||
|
const version3 = {faceapi: version2, node, browser, tfjs: version, backend: getBackend()};
|
||||||
});
|
});
|
||||||
|
|
||||||
// node_modules/@tensorflow/tfjs-core/dist/environment.js
|
// node_modules/@tensorflow/tfjs-core/dist/environment.js
|
||||||
|
@ -24387,7 +24389,7 @@ Manifest JSON has weights with names: ${allManifestWeightNames.join(", ")}.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// build/package.json
|
// build/package.json
|
||||||
var version2 = "0.4.6";
|
var version2 = "0.5.1";
|
||||||
return require_src();
|
return require_src();
|
||||||
})();
|
})();
|
||||||
//# sourceMappingURL=face-api.js.map
|
//# sourceMappingURL=face-api.js.map
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -123,7 +123,8 @@
|
||||||
await faceapi.tf.setBackend('webgl');
|
await faceapi.tf.setBackend('webgl');
|
||||||
await faceapi.tf.enableProdMode();
|
await faceapi.tf.enableProdMode();
|
||||||
await faceapi.tf.ENV.set('DEBUG', false);
|
await faceapi.tf.ENV.set('DEBUG', false);
|
||||||
log(`TensorFlow/JS Version: ${faceapi.tf.version_core} Backend ${faceapi.tf.getBackend()}`);
|
// check version
|
||||||
|
log(`Version: ${str(faceapi.version)}`);
|
||||||
|
|
||||||
// load face-api models
|
// load face-api models
|
||||||
log('Loading FaceAPI models');
|
log('Loading FaceAPI models');
|
||||||
|
@ -136,8 +137,7 @@
|
||||||
const optionsTinyFace = new faceapi.TinyFaceDetectorOptions({ inputSize: imgSize, scoreThreshold: minScore });
|
const optionsTinyFace = new faceapi.TinyFaceDetectorOptions({ inputSize: imgSize, scoreThreshold: minScore });
|
||||||
const optionsSSDMobileNet = new faceapi.SsdMobilenetv1Options({ minConfidence: minScore, maxResults });
|
const optionsSSDMobileNet = new faceapi.SsdMobilenetv1Options({ minConfidence: minScore, maxResults });
|
||||||
|
|
||||||
// check tf state
|
// check tf engine state
|
||||||
log(`TF Flags: ${str(faceapi.tf.ENV.flags)}`);
|
|
||||||
const engine = await faceapi.tf.engine();
|
const engine = await faceapi.tf.engine();
|
||||||
log(`TF Engine State: ${str(engine.state)}`);
|
log(`TF Engine State: ${str(engine.state)}`);
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
// const os = require('os');
|
||||||
|
// const process = require('process');
|
||||||
|
|
||||||
import * as tf from '@tensorflow/tfjs-core';
|
import * as tf from '@tensorflow/tfjs-core';
|
||||||
import * as draw from './draw';
|
import * as draw from './draw';
|
||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
|
@ -21,4 +24,6 @@ export * from './NeuralNetwork';
|
||||||
export * from './resizeResults';
|
export * from './resizeResults';
|
||||||
|
|
||||||
import * as pkg from '../package.json';
|
import * as pkg from '../package.json';
|
||||||
export const version = { faceapi: pkg.version, tfjs_core: tf.version_core, env: tf.ENV.getFlags() };
|
const node = typeof process !== 'undefined' ? process.version : false
|
||||||
|
const browser = typeof navigator !== 'undefined' ? navigator.userAgent : false
|
||||||
|
export const version = { faceapi: pkg.version, node, browser, tfjs: tf.version_core, backend: tf.getBackend() };
|
||||||
|
|
Loading…
Reference in New Issue