simplify tfjs imports

pull/97/head
Vladimir Mandic 2021-09-16 08:30:50 -04:00
parent e2609a0ef2
commit c3049e7c29
13 changed files with 1842 additions and 466 deletions

View File

@ -11,6 +11,7 @@
### **HEAD -> master** 2021/09/11 mandic00@live.com ### **HEAD -> master** 2021/09/11 mandic00@live.com
- reduce bundle size
- enable webgl uniforms - enable webgl uniforms
### **1.5.2** 2021/09/10 mandic00@live.com ### **1.5.2** 2021/09/10 mandic00@live.com

View File

@ -67,6 +67,14 @@
"output": "dist/face-api.node-gpu.js", "output": "dist/face-api.node-gpu.js",
"external": ["@tensorflow"] "external": ["@tensorflow"]
}, },
{
"name": "tfjs/browser/tf-version",
"platform": "browser",
"format": "esm",
"input": "src/tfjs/tf-version.ts",
"output": "dist/tfjs.version.js",
"external": ["fs", "os", "buffer", "util"]
},
{ {
"name": "tfjs/browser/esm/nobundle", "name": "tfjs/browser/esm/nobundle",
"platform": "browser", "platform": "browser",

View File

@ -29,39 +29,31 @@ var __reExport = (target, module2, desc) => {
// dist/tfjs.esm.js // dist/tfjs.esm.js
var tfjs_esm_exports = {}; var tfjs_esm_exports = {};
__export(tfjs_esm_exports, { __export(tfjs_esm_exports, {
data: () => data, version: () => version9
version: () => version
}); });
__reExport(tfjs_esm_exports, dist_star); __reExport(tfjs_esm_exports, dist_star);
__reExport(tfjs_esm_exports, dist_star2); __reExport(tfjs_esm_exports, dist_star2);
__reExport(tfjs_esm_exports, dist_star3); __reExport(tfjs_esm_exports, dist_star3);
__reExport(tfjs_esm_exports, dist_star4); import * as dist_star from "@tensorflow/tfjs/dist/index.js";
__reExport(tfjs_esm_exports, dist_star5); import * as dist_star2 from "@tensorflow/tfjs-backend-webgl/dist/index.js";
__reExport(tfjs_esm_exports, dist_star6); import * as dist_star3 from "@tensorflow/tfjs-backend-wasm/dist/index.js";
import { version as tfjsVersion } from "@tensorflow/tfjs/package.json"; var version = "3.9.0";
import { version as tfjsCoreVersion } from "@tensorflow/tfjs-core/package.json"; var version2 = "3.9.0";
import { version as tfjsDataVersion } from "@tensorflow/tfjs-data/package.json"; var version3 = "3.9.0";
import { version as tfjsLayersVersion } from "@tensorflow/tfjs-layers/package.json"; var version4 = "3.9.0";
import { version as tfjsConverterVersion } from "@tensorflow/tfjs-converter/package.json"; var version5 = "3.9.0";
import { version as tfjsBackendCPUVersion } from "@tensorflow/tfjs-backend-cpu/package.json"; var version6 = "3.9.0";
import { version as tfjsBackendWebGLVersion } from "@tensorflow/tfjs-backend-webgl/package.json"; var version7 = "3.9.0";
import { version as tfjsBackendWASMVersion } from "@tensorflow/tfjs-backend-wasm/package.json"; var version8 = "3.9.0";
import * as dist_star from "@tensorflow/tfjs-core/dist/index.js"; var version9 = {
import * as dist_star2 from "@tensorflow/tfjs-layers/dist/index.js"; tfjs: version,
import * as dist_star3 from "@tensorflow/tfjs-converter/dist/index.js"; "tfjs-core": version2,
import * as data from "@tensorflow/tfjs-data/dist/index.js"; "tfjs-data": version3,
import * as dist_star4 from "@tensorflow/tfjs-backend-cpu/dist/index.js"; "tfjs-layers": version4,
import * as dist_star5 from "@tensorflow/tfjs-backend-webgl/dist/index.js"; "tfjs-converter": version5,
import * as dist_star6 from "@tensorflow/tfjs-backend-wasm/dist/index.js"; "tfjs-backend-cpu": version6,
var version = { "tfjs-backend-webgl": version7,
tfjs: tfjsVersion, "tfjs-backend-wasm": version8
"tfjs-core": tfjsCoreVersion,
"tfjs-data": tfjsDataVersion,
"tfjs-layers": tfjsLayersVersion,
"tfjs-converter": tfjsConverterVersion,
"tfjs-backend-cpu": tfjsBackendCPUVersion,
"tfjs-backend-webgl": tfjsBackendWebGLVersion,
"tfjs-backend-wasm": tfjsBackendWASMVersion
}; };
// src/draw/index.ts // src/draw/index.ts
@ -2009,9 +2001,9 @@ var FaceExpressionNet = class extends FaceProcessor {
const netInput = await toNetInput(input); const netInput = await toNetInput(input);
const out = await this.forwardInput(netInput); const out = await this.forwardInput(netInput);
const probabilitesByBatch = await Promise.all(tfjs_esm_exports.unstack(out).map(async (t) => { const probabilitesByBatch = await Promise.all(tfjs_esm_exports.unstack(out).map(async (t) => {
const data2 = t.dataSync(); const data = t.dataSync();
t.dispose(); t.dispose();
return data2; return data;
})); }));
out.dispose(); out.dispose();
const predictionsByBatch = probabilitesByBatch.map((probabilites) => new FaceExpressions(probabilites)); const predictionsByBatch = probabilitesByBatch.map((probabilites) => new FaceExpressions(probabilites));
@ -2156,7 +2148,7 @@ function drawFaceLandmarks(canvasArg, faceLandmarks) {
} }
// package.json // package.json
var version2 = "1.5.2"; var version10 = "1.5.2";
// src/xception/extractParams.ts // src/xception/extractParams.ts
function extractorsFactory2(extractWeights, paramMappings) { function extractorsFactory2(extractWeights, paramMappings) {
@ -4390,7 +4382,7 @@ function resizeResults(results, dimensions) {
// src/index.ts // src/index.ts
var node = typeof process !== "undefined"; var node = typeof process !== "undefined";
var browser3 = typeof navigator !== "undefined" && typeof navigator.userAgent !== "undefined"; var browser3 = typeof navigator !== "undefined" && typeof navigator.userAgent !== "undefined";
var version3 = { faceapi: version2, node, browser: browser3 }; var version11 = { faceapi: version10, node, browser: browser3 };
if (browser3) { if (browser3) {
tfjs_esm_exports.ENV.set("CHECK_COMPUTATION_FOR_ERRORS", false); tfjs_esm_exports.ENV.set("CHECK_COMPUTATION_FOR_ERRORS", false);
tfjs_esm_exports.ENV.set("WEBGL_CPU_FORWARD", true); tfjs_esm_exports.ENV.set("WEBGL_CPU_FORWARD", true);
@ -4518,6 +4510,6 @@ export {
toNetInput, toNetInput,
utils_exports as utils, utils_exports as utils,
validateConfig, validateConfig,
version3 as version version11 as version
}; };
//# sourceMappingURL=face-api.esm-nobundle.js.map //# sourceMappingURL=face-api.esm-nobundle.js.map

File diff suppressed because one or more lines are too long

627
dist/face-api.esm.js vendored
View File

@ -124,7 +124,6 @@ __export(tfjs_esm_exports, {
LogicalAnd: () => LogicalAnd, LogicalAnd: () => LogicalAnd,
LogicalNot: () => LogicalNot, LogicalNot: () => LogicalNot,
LogicalOr: () => LogicalOr, LogicalOr: () => LogicalOr,
MathBackendCPU: () => MathBackendCPU,
MathBackendWebGL: () => MathBackendWebGL, MathBackendWebGL: () => MathBackendWebGL,
Max: () => Max, Max: () => Max,
MaxPool: () => MaxPool, MaxPool: () => MaxPool,
@ -434,7 +433,6 @@ __export(tfjs_esm_exports, {
setWasmPaths: () => setWasmPaths, setWasmPaths: () => setWasmPaths,
setWebGLContext: () => setWebGLContext, setWebGLContext: () => setWebGLContext,
setdiff1dAsync: () => setdiff1dAsync, setdiff1dAsync: () => setdiff1dAsync,
shared: () => shared_exports,
sigmoid: () => sigmoid, sigmoid: () => sigmoid,
sign: () => sign, sign: () => sign,
signal: () => signal, signal: () => signal,
@ -493,13 +491,12 @@ __export(tfjs_esm_exports, {
valueAndGrads: () => valueAndGrads, valueAndGrads: () => valueAndGrads,
variable: () => variable, variable: () => variable,
variableGrads: () => variableGrads, variableGrads: () => variableGrads,
version: () => version16, version: () => version92,
version_converter: () => version11, version_converter: () => version3,
version_core: () => version9, version_core: () => version,
version_cpu: () => version13, version_layers: () => version2,
version_layers: () => version10, version_wasm: () => version8,
version_wasm: () => version15, version_webgl: () => version5,
version_webgl: () => version14,
webgl: () => webgl, webgl: () => webgl,
webgl_util: () => webgl_util_exports, webgl_util: () => webgl_util_exports,
where: () => where, where: () => where,
@ -6010,14 +6007,6 @@ var require_tfjs_backend_wasm = __commonJS({
exports["WasmBackendModule"] = WasmBackendModule; exports["WasmBackendModule"] = WasmBackendModule;
} }
}); });
var version = "3.9.0";
var version2 = "3.9.0";
var version3 = "3.9.0";
var version4 = "3.9.0";
var version5 = "3.9.0";
var version6 = "3.9.0";
var version7 = "3.9.0";
var version8 = "3.9.0";
var EPSILON_FLOAT32 = 1e-7; var EPSILON_FLOAT32 = 1e-7;
var EPSILON_FLOAT16 = 1e-4; var EPSILON_FLOAT16 = 1e-4;
var DataStorage = class { var DataStorage = class {
@ -10920,7 +10909,7 @@ function encodeStrings(a) {
} }
return a; return a;
} }
var version9 = "3.9.0"; var version = "3.9.0";
function enableProdMode() { function enableProdMode() {
env().set("PROD", true); env().set("PROD", true);
} }
@ -17947,6 +17936,551 @@ var gradConfigs = [
for (const gradientConfig of gradConfigs) { for (const gradientConfig of gradConfigs) {
registerGradient(gradientConfig); registerGradient(gradientConfig);
} }
getGlobalTensorClass().prototype.abs = function() {
this.throwIfDisposed();
return abs(this);
};
getGlobalTensorClass().prototype.acos = function() {
this.throwIfDisposed();
return acos(this);
};
getGlobalTensorClass().prototype.acosh = function() {
this.throwIfDisposed();
return acosh(this);
};
getGlobalTensorClass().prototype.add = function(b) {
this.throwIfDisposed();
return add2(this, b);
};
getGlobalTensorClass().prototype.all = function(axis, keepDims) {
this.throwIfDisposed();
return all(this, axis, keepDims);
};
getGlobalTensorClass().prototype.any = function(axis, keepDims) {
this.throwIfDisposed();
return any(this, axis, keepDims);
};
getGlobalTensorClass().prototype.argMax = function(axis) {
this.throwIfDisposed();
return argMax(this, axis);
};
getGlobalTensorClass().prototype.argMin = function(axis) {
this.throwIfDisposed();
return argMin(this, axis);
};
getGlobalTensorClass().prototype.asScalar = function() {
this.throwIfDisposed();
assert(this.size === 1, () => "The array must have only 1 element.");
return reshape(this, []);
};
getGlobalTensorClass().prototype.asType = function(dtype) {
this.throwIfDisposed();
return cast(this, dtype);
};
getGlobalTensorClass().prototype.as1D = function() {
this.throwIfDisposed();
return reshape(this, [this.size]);
};
getGlobalTensorClass().prototype.as2D = function(rows, columns) {
this.throwIfDisposed();
return reshape(this, [rows, columns]);
};
getGlobalTensorClass().prototype.as3D = function(rows, columns, depth) {
this.throwIfDisposed();
return reshape(this, [rows, columns, depth]);
};
getGlobalTensorClass().prototype.as4D = function(rows, columns, depth, depth2) {
this.throwIfDisposed();
return reshape(this, [rows, columns, depth, depth2]);
};
getGlobalTensorClass().prototype.as5D = function(rows, columns, depth, depth2, depth3) {
this.throwIfDisposed();
return reshape(this, [rows, columns, depth, depth2, depth3]);
};
getGlobalTensorClass().prototype.asin = function() {
this.throwIfDisposed();
return asin(this);
};
getGlobalTensorClass().prototype.asinh = function() {
this.throwIfDisposed();
return asinh(this);
};
getGlobalTensorClass().prototype.atan = function() {
this.throwIfDisposed();
return atan(this);
};
getGlobalTensorClass().prototype.atan2 = function(b) {
this.throwIfDisposed();
return atan2(this, b);
};
getGlobalTensorClass().prototype.atanh = function() {
this.throwIfDisposed();
return atanh(this);
};
getGlobalTensorClass().prototype.avgPool = function(filterSize, strides, pad3, dimRoundingMode) {
this.throwIfDisposed();
return avgPool(this, filterSize, strides, pad3, dimRoundingMode);
};
getGlobalTensorClass().prototype.batchToSpaceND = function(blockShape, crops) {
this.throwIfDisposed();
return batchToSpaceND(this, blockShape, crops);
};
getGlobalTensorClass().prototype.batchNorm = function(mean4, variance, offset, scale22, varianceEpsilon) {
this.throwIfDisposed();
return batchNorm(this, mean4, variance, offset, scale22, varianceEpsilon);
};
getGlobalTensorClass().prototype.broadcastTo = function(shape) {
this.throwIfDisposed();
return broadcastTo(this, shape);
};
getGlobalTensorClass().prototype.cast = function(dtype) {
this.throwIfDisposed();
return cast(this, dtype);
};
getGlobalTensorClass().prototype.ceil = function() {
this.throwIfDisposed();
return ceil(this);
};
getGlobalTensorClass().prototype.clipByValue = function(min6, max6) {
this.throwIfDisposed();
return clipByValue(this, min6, max6);
};
getGlobalTensorClass().prototype.concat = function(x, axis) {
this.throwIfDisposed();
if (x instanceof Tensor) {
x = [x];
}
return concat([this, ...x], axis);
};
getGlobalTensorClass().prototype.conv1d = function(filter, stride, pad3, dataFormat, dilation, dimRoundingMode) {
this.throwIfDisposed();
return conv1d(this, filter, stride, pad3, dataFormat, dilation, dimRoundingMode);
};
getGlobalTensorClass().prototype.conv2dTranspose = function(filter, outputShape, strides, pad3, dimRoundingMode) {
this.throwIfDisposed();
return conv2dTranspose(this, filter, outputShape, strides, pad3, dimRoundingMode);
};
getGlobalTensorClass().prototype.conv2d = function(filter, strides, pad3, dataFormat, dilations, dimRoundingMode) {
this.throwIfDisposed();
return conv2d(this, filter, strides, pad3, dataFormat, dilations, dimRoundingMode);
};
getGlobalTensorClass().prototype.cos = function() {
this.throwIfDisposed();
return cos(this);
};
getGlobalTensorClass().prototype.cosh = function() {
this.throwIfDisposed();
return cosh(this);
};
getGlobalTensorClass().prototype.cumsum = function(axis, exclusive, reverse5) {
this.throwIfDisposed();
return cumsum(this, axis, exclusive, reverse5);
};
getGlobalTensorClass().prototype.depthToSpace = function(blockSize, dataFormat) {
this.throwIfDisposed();
return depthToSpace(this, blockSize, dataFormat);
};
getGlobalTensorClass().prototype.depthwiseConv2d = function(filter, strides, pad3, dataFormat, dilations, dimRoundingMode) {
this.throwIfDisposed();
return depthwiseConv2d(this, filter, strides, pad3, dataFormat, dilations, dimRoundingMode);
};
getGlobalTensorClass().prototype.dilation2d = function(filter, strides, pad3, dilations, dataFormat) {
this.throwIfDisposed();
return dilation2d(this, filter, strides, pad3, dilations, dataFormat);
};
getGlobalTensorClass().prototype.divNoNan = function(b) {
this.throwIfDisposed();
return divNoNan(this, b);
};
getGlobalTensorClass().prototype.div = function(b) {
this.throwIfDisposed();
return div(this, b);
};
getGlobalTensorClass().prototype.dot = function(b) {
this.throwIfDisposed();
return dot(this, b);
};
getGlobalTensorClass().prototype.elu = function() {
this.throwIfDisposed();
return elu(this);
};
getGlobalTensorClass().prototype.equal = function(b) {
this.throwIfDisposed();
return equal(this, b);
};
getGlobalTensorClass().prototype.erf = function() {
this.throwIfDisposed();
return erf(this);
};
getGlobalTensorClass().prototype.exp = function() {
this.throwIfDisposed();
return exp(this);
};
getGlobalTensorClass().prototype.expandDims = function(axis) {
this.throwIfDisposed();
return expandDims(this, axis);
};
getGlobalTensorClass().prototype.expm1 = function() {
this.throwIfDisposed();
return expm1(this);
};
getGlobalTensorClass().prototype.fft = function() {
this.throwIfDisposed();
return fft(this);
};
getGlobalTensorClass().prototype.flatten = function() {
this.throwIfDisposed();
return reshape(this, [this.size]);
};
getGlobalTensorClass().prototype.floor = function() {
this.throwIfDisposed();
return floor(this);
};
getGlobalTensorClass().prototype.floorDiv = function(b) {
this.throwIfDisposed();
return floorDiv(this, b);
};
getGlobalTensorClass().prototype.gather = function(indices, axis) {
this.throwIfDisposed();
return gather(this, indices, axis);
};
getGlobalTensorClass().prototype.greaterEqual = function(b) {
this.throwIfDisposed();
return greaterEqual(this, b);
};
getGlobalTensorClass().prototype.greater = function(b) {
this.throwIfDisposed();
return greater(this, b);
};
getGlobalTensorClass().prototype.ifft = function() {
this.throwIfDisposed();
return ifft(this);
};
getGlobalTensorClass().prototype.irfft = function() {
this.throwIfDisposed();
return irfft(this);
};
getGlobalTensorClass().prototype.isFinite = function() {
this.throwIfDisposed();
return isFinite2(this);
};
getGlobalTensorClass().prototype.isInf = function() {
this.throwIfDisposed();
return isInf(this);
};
getGlobalTensorClass().prototype.isNaN = function() {
this.throwIfDisposed();
return isNaN2(this);
};
getGlobalTensorClass().prototype.leakyRelu = function(alpha) {
this.throwIfDisposed();
return leakyRelu(this, alpha);
};
getGlobalTensorClass().prototype.lessEqual = function(b) {
this.throwIfDisposed();
return lessEqual(this, b);
};
getGlobalTensorClass().prototype.less = function(b) {
this.throwIfDisposed();
return less(this, b);
};
getGlobalTensorClass().prototype.localResponseNormalization = function(depthRadius, bias, alpha, beta) {
this.throwIfDisposed();
return localResponseNormalization(this, depthRadius, bias, alpha, beta);
};
getGlobalTensorClass().prototype.logSigmoid = function() {
this.throwIfDisposed();
return logSigmoid(this);
};
getGlobalTensorClass().prototype.logSoftmax = function(axis) {
this.throwIfDisposed();
return logSoftmax(this, axis);
};
getGlobalTensorClass().prototype.logSumExp = function(axis, keepDims) {
this.throwIfDisposed();
return logSumExp(this, axis, keepDims);
};
getGlobalTensorClass().prototype.log = function() {
this.throwIfDisposed();
return log5(this);
};
getGlobalTensorClass().prototype.log1p = function() {
this.throwIfDisposed();
return log1p(this);
};
getGlobalTensorClass().prototype.logicalAnd = function(b) {
this.throwIfDisposed();
return logicalAnd(this, b);
};
getGlobalTensorClass().prototype.logicalNot = function() {
this.throwIfDisposed();
return logicalNot(this);
};
getGlobalTensorClass().prototype.logicalOr = function(b) {
this.throwIfDisposed();
return logicalOr(this, b);
};
getGlobalTensorClass().prototype.logicalXor = function(b) {
this.throwIfDisposed();
return logicalXor(this, b);
};
getGlobalTensorClass().prototype.matMul = function(b, transposeA, transposeB) {
this.throwIfDisposed();
return matMul(this, b, transposeA, transposeB);
};
getGlobalTensorClass().prototype.maxPool = function(filterSize, strides, pad3, dimRoundingMode) {
this.throwIfDisposed();
return maxPool(this, filterSize, strides, pad3, dimRoundingMode);
};
getGlobalTensorClass().prototype.max = function(axis, keepDims) {
this.throwIfDisposed();
return max(this, axis, keepDims);
};
getGlobalTensorClass().prototype.maximum = function(b) {
this.throwIfDisposed();
return maximum(this, b);
};
getGlobalTensorClass().prototype.mean = function(axis, keepDims) {
this.throwIfDisposed();
return mean(this, axis, keepDims);
};
getGlobalTensorClass().prototype.min = function(axis, keepDims) {
this.throwIfDisposed();
return min(this, axis, keepDims);
};
getGlobalTensorClass().prototype.minimum = function(b) {
this.throwIfDisposed();
return minimum(this, b);
};
getGlobalTensorClass().prototype.mirrorPad = function(paddings, mode) {
this.throwIfDisposed();
return mirrorPad(this, paddings, mode);
};
getGlobalTensorClass().prototype.mod = function(b) {
this.throwIfDisposed();
return mod(this, b);
};
getGlobalTensorClass().prototype.mul = function(b) {
this.throwIfDisposed();
return mul(this, b);
};
getGlobalTensorClass().prototype.neg = function() {
this.throwIfDisposed();
return neg(this);
};
getGlobalTensorClass().prototype.norm = function(ord, axis, keepDims) {
this.throwIfDisposed();
return norm(this, ord, axis, keepDims);
};
getGlobalTensorClass().prototype.notEqual = function(b) {
this.throwIfDisposed();
return notEqual(this, b);
};
getGlobalTensorClass().prototype.oneHot = function(depth, onValue = 1, offValue = 0) {
this.throwIfDisposed();
return oneHot(this, depth, onValue, offValue);
};
getGlobalTensorClass().prototype.onesLike = function() {
this.throwIfDisposed();
return onesLike(this);
};
getGlobalTensorClass().prototype.pad = function(paddings, constantValue) {
this.throwIfDisposed();
return pad(this, paddings, constantValue);
};
getGlobalTensorClass().prototype.pool = function(windowShape, poolingType, padding, dilationRate, strides) {
this.throwIfDisposed();
return pool(this, windowShape, poolingType, padding, dilationRate, strides);
};
getGlobalTensorClass().prototype.pow = function(exp4) {
this.throwIfDisposed();
return pow(this, exp4);
};
getGlobalTensorClass().prototype.prelu = function(alpha) {
this.throwIfDisposed();
return prelu(this, alpha);
};
getGlobalTensorClass().prototype.prod = function(axis, keepDims) {
this.throwIfDisposed();
return prod(this, axis, keepDims);
};
getGlobalTensorClass().prototype.reciprocal = function() {
this.throwIfDisposed();
return reciprocal(this);
};
getGlobalTensorClass().prototype.relu = function() {
this.throwIfDisposed();
return relu(this);
};
getGlobalTensorClass().prototype.relu6 = function() {
this.throwIfDisposed();
return relu6(this);
};
getGlobalTensorClass().prototype.reshapeAs = function(x) {
this.throwIfDisposed();
return reshape(this, x.shape);
};
getGlobalTensorClass().prototype.reshape = function(shape) {
this.throwIfDisposed();
return reshape(this, shape);
};
getGlobalTensorClass().prototype.resizeBilinear = function(newShape2D, alignCorners, halfPixelCenters) {
this.throwIfDisposed();
return resizeBilinear(this, newShape2D, alignCorners, halfPixelCenters);
};
getGlobalTensorClass().prototype.resizeNearestNeighbor = function(newShape2D, alignCorners, halfFloatCenters) {
this.throwIfDisposed();
return resizeNearestNeighbor(this, newShape2D, alignCorners, halfFloatCenters);
};
getGlobalTensorClass().prototype.reverse = function(axis) {
this.throwIfDisposed();
return reverse(this, axis);
};
getGlobalTensorClass().prototype.rfft = function() {
this.throwIfDisposed();
return rfft(this);
};
getGlobalTensorClass().prototype.round = function() {
this.throwIfDisposed();
return round2(this);
};
getGlobalTensorClass().prototype.rsqrt = function() {
this.throwIfDisposed();
return rsqrt(this);
};
getGlobalTensorClass().prototype.selu = function() {
this.throwIfDisposed();
return selu(this);
};
getGlobalTensorClass().prototype.separableConv2d = function(depthwiseFilter, pointwiseFilter, strides, pad3, dilation, dataFormat) {
this.throwIfDisposed();
return separableConv2d(this, depthwiseFilter, pointwiseFilter, strides, pad3, dilation, dataFormat);
};
getGlobalTensorClass().prototype.sigmoid = function() {
this.throwIfDisposed();
return sigmoid(this);
};
getGlobalTensorClass().prototype.sign = function() {
this.throwIfDisposed();
return sign(this);
};
getGlobalTensorClass().prototype.sin = function() {
this.throwIfDisposed();
return sin(this);
};
getGlobalTensorClass().prototype.sinh = function() {
this.throwIfDisposed();
return sinh(this);
};
getGlobalTensorClass().prototype.slice = function(begin, size) {
this.throwIfDisposed();
return slice(this, begin, size);
};
getGlobalTensorClass().prototype.softmax = function(dim) {
this.throwIfDisposed();
return softmax(this, dim);
};
getGlobalTensorClass().prototype.softplus = function() {
this.throwIfDisposed();
return softplus(this);
};
getGlobalTensorClass().prototype.spaceToBatchND = function(blockShape, paddings) {
this.throwIfDisposed();
return spaceToBatchND(this, blockShape, paddings);
};
getGlobalTensorClass().prototype.split = function(numOrSizeSplits, axis) {
this.throwIfDisposed();
return split(this, numOrSizeSplits, axis);
};
getGlobalTensorClass().prototype.sqrt = function() {
this.throwIfDisposed();
return sqrt(this);
};
getGlobalTensorClass().prototype.square = function() {
this.throwIfDisposed();
return square(this);
};
getGlobalTensorClass().prototype.squaredDifference = function(b) {
this.throwIfDisposed();
return squaredDifference(this, b);
};
getGlobalTensorClass().prototype.squeeze = function(axis) {
this.throwIfDisposed();
return squeeze(this, axis);
};
getGlobalTensorClass().prototype.stack = function(x, axis) {
this.throwIfDisposed();
const tensorsToBeStacked = x instanceof Tensor ? [this, x] : [this, ...x];
return stack(tensorsToBeStacked, axis);
};
getGlobalTensorClass().prototype.step = function(alpha) {
this.throwIfDisposed();
return step(this, alpha);
};
getGlobalTensorClass().prototype.stridedSlice = function(begin, end, strides, beginMask, endMask, ellipsisMask, newAxisMask, shrinkAxisMask) {
this.throwIfDisposed();
return stridedSlice(this, begin, end, strides, beginMask, endMask, ellipsisMask, newAxisMask, shrinkAxisMask);
};
getGlobalTensorClass().prototype.sub = function(b) {
this.throwIfDisposed();
return sub(this, b);
};
getGlobalTensorClass().prototype.sum = function(axis, keepDims) {
this.throwIfDisposed();
return sum2(this, axis, keepDims);
};
getGlobalTensorClass().prototype.tan = function() {
this.throwIfDisposed();
return tan(this);
};
getGlobalTensorClass().prototype.tanh = function() {
this.throwIfDisposed();
return tanh2(this);
};
getGlobalTensorClass().prototype.tile = function(reps) {
this.throwIfDisposed();
return tile(this, reps);
};
getGlobalTensorClass().prototype.toBool = function() {
this.throwIfDisposed();
return cast(this, "bool");
};
getGlobalTensorClass().prototype.toFloat = function() {
this.throwIfDisposed();
return cast(this, "float32");
};
getGlobalTensorClass().prototype.toInt = function() {
this.throwIfDisposed();
return cast(this, "int32");
};
getGlobalTensorClass().prototype.topk = function(k, sorted) {
this.throwIfDisposed();
return topk(this, k, sorted);
};
getGlobalTensorClass().prototype.transpose = function(perm) {
this.throwIfDisposed();
return transpose(this, perm);
};
getGlobalTensorClass().prototype.unique = function(axis) {
this.throwIfDisposed();
return unique(this, axis);
};
getGlobalTensorClass().prototype.unsortedSegmentSum = function(segmentIds, numSegments) {
this.throwIfDisposed();
return unsortedSegmentSum(this, segmentIds, numSegments);
};
getGlobalTensorClass().prototype.unstack = function(axis) {
this.throwIfDisposed();
return unstack(this, axis);
};
getGlobalTensorClass().prototype.where = function(condition, x) {
this.throwIfDisposed();
return where(condition, this, x);
};
getGlobalTensorClass().prototype.zerosLike = function() {
this.throwIfDisposed();
return zerosLike(this);
};
var exports_constraints_exports = {}; var exports_constraints_exports = {};
__export2(exports_constraints_exports, { __export2(exports_constraints_exports, {
maxNorm: () => maxNorm, maxNorm: () => maxNorm,
@ -21031,7 +21565,7 @@ function convertTsToPythonic(tsConfig, key) {
return pyDict; return pyDict;
} }
} }
var version10 = "3.9.0"; var version2 = "3.9.0";
function assertFeedCompatibility(key, val) { function assertFeedCompatibility(key, val) {
if (key.dtype == null || key.dtype === val.dtype) { if (key.dtype == null || key.dtype === val.dtype) {
return val; return val;
@ -21635,7 +22169,7 @@ var Container = class extends Layer {
const modelConfig = {}; const modelConfig = {};
modelConfig["className"] = this.getClassName(); modelConfig["className"] = this.getClassName();
modelConfig["config"] = theConfig; modelConfig["config"] = theConfig;
modelConfig["kerasVersion"] = `tfjs-layers ${version10}`; modelConfig["kerasVersion"] = `tfjs-layers ${version2}`;
modelConfig["backend"] = "TensorFlow.js"; modelConfig["backend"] = "TensorFlow.js";
return modelConfig; return modelConfig;
} }
@ -23427,7 +23961,7 @@ var LayersModel = class extends Container {
const modelArtifacts = { const modelArtifacts = {
modelTopology: modelConfig, modelTopology: modelConfig,
format: LAYERS_MODEL_FORMAT_NAME, format: LAYERS_MODEL_FORMAT_NAME,
generatedBy: `TensorFlow.js tfjs-layers v${version10}`, generatedBy: `TensorFlow.js tfjs-layers v${version2}`,
convertedBy: null convertedBy: null
}; };
const includeOptimizer = config == null ? false : config.includeOptimizer; const includeOptimizer = config == null ? false : config.includeOptimizer;
@ -35050,7 +35584,7 @@ async function loadGraphModel(modelUrl, options = {}) {
await model2.load(); await model2.load();
return model2; return model2;
} }
var version11 = "3.9.0"; var version3 = "3.9.0";
var dist_exports = {}; var dist_exports = {};
__export2(dist_exports, { __export2(dist_exports, {
CSVDataset: () => CSVDataset, CSVDataset: () => CSVDataset,
@ -35063,7 +35597,7 @@ __export2(dist_exports, {
func: () => func, func: () => func,
generator: () => generator, generator: () => generator,
microphone: () => microphone, microphone: () => microphone,
version_data: () => version12, version_data: () => version4,
webcam: () => webcam, webcam: () => webcam,
zip: () => zip zip: () => zip
}); });
@ -36779,7 +37313,7 @@ async function webcam(webcamVideoElement, webcamConfig) {
async function microphone(microphoneConfig) { async function microphone(microphoneConfig) {
return MicrophoneIterator.create(microphoneConfig); return MicrophoneIterator.create(microphoneConfig);
} }
var version12 = "3.9.0"; var version4 = "3.9.0";
function assertNotComplex(tensor2, opName) { function assertNotComplex(tensor2, opName) {
if (!Array.isArray(tensor2)) { if (!Array.isArray(tensor2)) {
tensor2 = [tensor2]; tensor2 = [tensor2];
@ -38275,7 +38809,6 @@ function uniqueImpl(values, axis, shape, dtype) {
indices indices
}; };
} }
var version13 = "3.9.0";
registerBackend("cpu", () => new MathBackendCPU(), 1); registerBackend("cpu", () => new MathBackendCPU(), 1);
var elu4 = unaryKernelFunc(Elu, (xi) => xi >= 0 ? xi : Math.exp(xi) - 1); var elu4 = unaryKernelFunc(Elu, (xi) => xi >= 0 ? xi : Math.exp(xi) - 1);
var eluConfig = { var eluConfig = {
@ -43552,7 +44085,7 @@ ENV3.registerFlag("WEBGL_USE_SHAPES_UNIFORMS", () => false);
ENV3.registerFlag("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD", () => 1e5); ENV3.registerFlag("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD", () => 1e5);
ENV3.registerFlag("TOPK_K_CPU_HANDOFF_THRESHOLD", () => 128); ENV3.registerFlag("TOPK_K_CPU_HANDOFF_THRESHOLD", () => 128);
function getGlslDifferences() { function getGlslDifferences() {
let version172; let version10;
let attribute; let attribute;
let varyingVs; let varyingVs;
let varyingFs; let varyingFs;
@ -43563,7 +44096,7 @@ function getGlslDifferences() {
let defineSpecialInf; let defineSpecialInf;
let defineRound; let defineRound;
if (env().getNumber("WEBGL_VERSION") === 2) { if (env().getNumber("WEBGL_VERSION") === 2) {
version172 = "#version 300 es"; version10 = "#version 300 es";
attribute = "in"; attribute = "in";
varyingVs = "out"; varyingVs = "out";
varyingFs = "in"; varyingFs = "in";
@ -43594,7 +44127,7 @@ function getGlslDifferences() {
} }
`; `;
} else { } else {
version172 = ""; version10 = "";
attribute = "attribute"; attribute = "attribute";
varyingVs = "varying"; varyingVs = "varying";
varyingFs = "varying"; varyingFs = "varying";
@ -43631,7 +44164,7 @@ function getGlslDifferences() {
`; `;
} }
return { return {
version: version172, version: version10,
attribute, attribute,
varyingVs, varyingVs,
varyingFs, varyingFs,
@ -47518,7 +48051,7 @@ function float32ToTypedArray(a, dtype) {
throw new Error(`Unknown dtype ${dtype}`); throw new Error(`Unknown dtype ${dtype}`);
} }
} }
var version14 = "3.9.0"; var version5 = "3.9.0";
function forceHalfFloat() { function forceHalfFloat() {
env().set("WEBGL_FORCE_F16_TEXTURES", true); env().set("WEBGL_FORCE_F16_TEXTURES", true);
} }
@ -59555,21 +60088,29 @@ function setWasmPaths(prefixOrFileMap, usePlatformFetch = false) {
} }
customFetch = usePlatformFetch; customFetch = usePlatformFetch;
} }
var version15 = "3.9.0"; var version8 = "3.9.0";
var WASM_PRIORITY = 2; var WASM_PRIORITY = 2;
registerBackend("wasm", async () => { registerBackend("wasm", async () => {
const { wasm } = await init(); const { wasm } = await init();
return new BackendWasm(wasm); return new BackendWasm(wasm);
}, WASM_PRIORITY); }, WASM_PRIORITY);
var version16 = { var version9 = "3.9.0";
tfjs: version, var version22 = "3.9.0";
"tfjs-core": version2, var version32 = "3.9.0";
"tfjs-data": version3, var version42 = "3.9.0";
"tfjs-layers": version4, var version52 = "3.9.0";
"tfjs-converter": version5, var version62 = "3.9.0";
"tfjs-backend-cpu": version6, var version72 = "3.9.0";
"tfjs-backend-webgl": version7, var version82 = "3.9.0";
"tfjs-backend-wasm": version8 var version92 = {
tfjs: version9,
"tfjs-core": version22,
"tfjs-data": version32,
"tfjs-layers": version42,
"tfjs-converter": version52,
"tfjs-backend-cpu": version62,
"tfjs-backend-webgl": version72,
"tfjs-backend-wasm": version82
}; };
// src/draw/index.ts // src/draw/index.ts
@ -61664,7 +62205,7 @@ function drawFaceLandmarks(canvasArg, faceLandmarks) {
} }
// package.json // package.json
var version17 = "1.5.2"; var version6 = "1.5.2";
// src/xception/extractParams.ts // src/xception/extractParams.ts
function extractorsFactory2(extractWeights, paramMappings) { function extractorsFactory2(extractWeights, paramMappings) {
@ -63898,7 +64439,7 @@ function resizeResults(results, dimensions) {
// src/index.ts // src/index.ts
var node = typeof process !== "undefined"; var node = typeof process !== "undefined";
var browser = typeof navigator !== "undefined" && typeof navigator.userAgent !== "undefined"; var browser = typeof navigator !== "undefined" && typeof navigator.userAgent !== "undefined";
var version18 = { faceapi: version17, node, browser }; var version7 = { faceapi: version6, node, browser };
if (browser) { if (browser) {
ENV.set("CHECK_COMPUTATION_FOR_ERRORS", false); ENV.set("CHECK_COMPUTATION_FOR_ERRORS", false);
ENV.set("WEBGL_CPU_FORWARD", true); ENV.set("WEBGL_CPU_FORWARD", true);
@ -64026,7 +64567,7 @@ export {
toNetInput, toNetInput,
utils_exports as utils, utils_exports as utils,
validateConfig, validateConfig,
version18 as version version7 as version
}; };
/** /**
* @license * @license

File diff suppressed because one or more lines are too long

576
dist/face-api.js vendored

File diff suppressed because one or more lines are too long

911
dist/tfjs.esm.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

44
dist/tfjs.version.js vendored Normal file
View File

@ -0,0 +1,44 @@
/*
Face-API
homepage: <https://github.com/vladmandic/face-api>
author: <https://github.com/vladmandic>'
*/
// node_modules/.pnpm/@tensorflow+tfjs@3.9.0_seedrandom@3.0.5/node_modules/@tensorflow/tfjs/package.json
var version = "3.9.0";
// node_modules/.pnpm/@tensorflow+tfjs-core@3.9.0/node_modules/@tensorflow/tfjs-core/package.json
var version2 = "3.9.0";
// node_modules/.pnpm/@tensorflow+tfjs-data@3.9.0_470c05e138890ee649df8440b2dfddf4/node_modules/@tensorflow/tfjs-data/package.json
var version3 = "3.9.0";
// node_modules/.pnpm/@tensorflow+tfjs-layers@3.9.0_@tensorflow+tfjs-core@3.9.0/node_modules/@tensorflow/tfjs-layers/package.json
var version4 = "3.9.0";
// node_modules/.pnpm/@tensorflow+tfjs-converter@3.9.0_@tensorflow+tfjs-core@3.9.0/node_modules/@tensorflow/tfjs-converter/package.json
var version5 = "3.9.0";
// node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.9.0_@tensorflow+tfjs-core@3.9.0/node_modules/@tensorflow/tfjs-backend-cpu/package.json
var version6 = "3.9.0";
// node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.9.0_@tensorflow+tfjs-core@3.9.0/node_modules/@tensorflow/tfjs-backend-webgl/package.json
var version7 = "3.9.0";
// node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.9.0_@tensorflow+tfjs-core@3.9.0/node_modules/@tensorflow/tfjs-backend-wasm/package.json
var version8 = "3.9.0";
// src/tfjs/tf-version.ts
var version9 = {
tfjs: version,
"tfjs-core": version2,
"tfjs-data": version3,
"tfjs-layers": version4,
"tfjs-converter": version5,
"tfjs-backend-cpu": version6,
"tfjs-backend-webgl": version7,
"tfjs-backend-wasm": version8
};
export {
version9 as version
};

View File

@ -53,14 +53,14 @@
"@tensorflow/tfjs-node": "^3.9.0", "@tensorflow/tfjs-node": "^3.9.0",
"@tensorflow/tfjs-node-gpu": "^3.9.0", "@tensorflow/tfjs-node-gpu": "^3.9.0",
"@types/node": "^16.9.1", "@types/node": "^16.9.1",
"@typescript-eslint/eslint-plugin": "^4.31.0", "@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.0", "@typescript-eslint/parser": "^4.31.1",
"@vladmandic/build": "^0.4.1", "@vladmandic/build": "^0.4.1",
"@vladmandic/pilogger": "^0.3.1", "@vladmandic/pilogger": "^0.3.2",
"canvas": "^2.8.0", "canvas": "^2.8.0",
"chokidar": "^3.5.2", "chokidar": "^3.5.2",
"dayjs": "^1.10.7", "dayjs": "^1.10.7",
"esbuild": "^0.12.26", "esbuild": "^0.12.28",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1", "eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.24.2", "eslint-plugin-import": "^2.24.2",
@ -72,7 +72,7 @@
"seedrandom": "^3.0.5", "seedrandom": "^3.0.5",
"simple-git": "^2.45.1", "simple-git": "^2.45.1",
"tslib": "^2.3.1", "tslib": "^2.3.1",
"typedoc": "^0.22.2", "typedoc": "^0.22.3",
"typescript": "4.4.3" "typescript": "4.4.3"
} }
} }

View File

@ -3,36 +3,13 @@
* @external * @external
*/ */
// get versions of all packages // export all from build bundle
import { version as tfjsVersion } from '@tensorflow/tfjs/package.json'; export * from '@tensorflow/tfjs/dist/index.js';
import { version as tfjsCoreVersion } from '@tensorflow/tfjs-core/package.json';
import { version as tfjsDataVersion } from '@tensorflow/tfjs-data/package.json';
import { version as tfjsLayersVersion } from '@tensorflow/tfjs-layers/package.json';
import { version as tfjsConverterVersion } from '@tensorflow/tfjs-converter/package.json';
import { version as tfjsBackendCPUVersion } from '@tensorflow/tfjs-backend-cpu/package.json';
import { version as tfjsBackendWebGLVersion } from '@tensorflow/tfjs-backend-webgl/package.json';
import { version as tfjsBackendWASMVersion } from '@tensorflow/tfjs-backend-wasm/package.json';
// export all from build
export * from '@tensorflow/tfjs-core/dist/index.js';
export * from '@tensorflow/tfjs-layers/dist/index.js';
export * from '@tensorflow/tfjs-converter/dist/index.js';
export * as data from '@tensorflow/tfjs-data/dist/index.js';
export * from '@tensorflow/tfjs-backend-cpu/dist/index.js';
export * from '@tensorflow/tfjs-backend-webgl/dist/index.js'; export * from '@tensorflow/tfjs-backend-webgl/dist/index.js';
export * from '@tensorflow/tfjs-backend-wasm/dist/index.js'; export * from '@tensorflow/tfjs-backend-wasm/dist/index.js';
// export * from '@tensorflow/tfjs-backend-webgpu/dist/index.js'; // experimental
// export versions // add webgpu to bundle, experimental
export const version = { // export * from '@tensorflow/tfjs-backend-webgpu/dist/index.js';
tfjs: tfjsVersion,
'tfjs-core': tfjsCoreVersion,
'tfjs-data': tfjsDataVersion,
'tfjs-layers': tfjsLayersVersion,
'tfjs-converter': tfjsConverterVersion,
'tfjs-backend-cpu': tfjsBackendCPUVersion,
'tfjs-backend-webgl': tfjsBackendWebGLVersion,
'tfjs-backend-wasm': tfjsBackendWASMVersion,
};
// export * from '@tensorflow/tfjs'; // export versions, overrides version object from @tensorflow/tfjs
export { version } from '../../dist/tfjs.version.js';

20
src/tfjs/tf-version.ts Normal file
View File

@ -0,0 +1,20 @@
// get versions of all packages
import { version as tfjsVersion } from '@tensorflow/tfjs/package.json';
import { version as tfjsCoreVersion } from '@tensorflow/tfjs-core/package.json';
import { version as tfjsDataVersion } from '@tensorflow/tfjs-data/package.json';
import { version as tfjsLayersVersion } from '@tensorflow/tfjs-layers/package.json';
import { version as tfjsConverterVersion } from '@tensorflow/tfjs-converter/package.json';
import { version as tfjsBackendCPUVersion } from '@tensorflow/tfjs-backend-cpu/package.json';
import { version as tfjsBackendWebGLVersion } from '@tensorflow/tfjs-backend-webgl/package.json';
import { version as tfjsBackendWASMVersion } from '@tensorflow/tfjs-backend-wasm/package.json';
export const version = {
tfjs: tfjsVersion,
'tfjs-core': tfjsCoreVersion,
'tfjs-data': tfjsDataVersion,
'tfjs-layers': tfjsLayersVersion,
'tfjs-converter': tfjsConverterVersion,
'tfjs-backend-cpu': tfjsBackendCPUVersion,
'tfjs-backend-webgl': tfjsBackendWebGLVersion,
'tfjs-backend-wasm': tfjsBackendWASMVersion,
};