idmission-web-sdk 1.0.194 → 1.0.196
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sdk2.cjs.development.js +15 -36
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +15 -36
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +15 -36
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -48,7 +48,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
|
|
|
48
48
|
var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
|
|
49
49
|
var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
|
|
50
50
|
|
|
51
|
-
var webSdkVersion = '1.0.
|
|
51
|
+
var webSdkVersion = '1.0.196';
|
|
52
52
|
|
|
53
53
|
function getPlatform() {
|
|
54
54
|
if (typeof window === 'undefined') return;
|
|
@@ -1918,20 +1918,18 @@ function loadDocumentDetectionModel(url) {
|
|
|
1918
1918
|
return [4 /*yield*/, tf__namespace.loadGraphModel(url)];
|
|
1919
1919
|
case 1:
|
|
1920
1920
|
documentDetectionModel = _c.sent();
|
|
1921
|
-
return [4 /*yield*/, tf__namespace.ready()
|
|
1921
|
+
return [4 /*yield*/, tf__namespace.ready()
|
|
1922
|
+
// warm the model by predicting on an empty image
|
|
1923
|
+
];
|
|
1922
1924
|
case 2:
|
|
1923
1925
|
_c.sent();
|
|
1924
|
-
_c.label = 3;
|
|
1925
|
-
case 3:
|
|
1926
|
-
_c.trys.push([3,, 5, 6]);
|
|
1927
|
-
tf__namespace.engine().startScope();
|
|
1928
1926
|
zeroes = tf__namespace.zeros([448, 448, 3]);
|
|
1929
1927
|
tfInt32 = tf__namespace.cast(zeroes, 'int32');
|
|
1930
1928
|
tf4d_ = tf__namespace.tensor4d(Array.from(tfInt32.dataSync()), [1, 448, 448, 3]);
|
|
1931
1929
|
tf4d = tf__namespace.cast(tf4d_, 'int32');
|
|
1932
1930
|
_b = (_a = tf__namespace).dispose;
|
|
1933
1931
|
return [4 /*yield*/, documentDetectionModel.executeAsync(tf4d)];
|
|
1934
|
-
case
|
|
1932
|
+
case 3:
|
|
1935
1933
|
_b.apply(_a, [_c.sent()]);
|
|
1936
1934
|
tfInt32.dispose();
|
|
1937
1935
|
tf4d.dispose();
|
|
@@ -1945,11 +1943,6 @@ function loadDocumentDetectionModel(url) {
|
|
|
1945
1943
|
scores: outputKeys.indexOf('Identity_4'),
|
|
1946
1944
|
labels: outputKeys.indexOf('Identity_2')
|
|
1947
1945
|
};
|
|
1948
|
-
return [3 /*break*/, 6];
|
|
1949
|
-
case 5:
|
|
1950
|
-
tf__namespace.engine().endScope();
|
|
1951
|
-
return [7 /*endfinally*/];
|
|
1952
|
-
case 6:
|
|
1953
1946
|
return [2 /*return*/, documentDetectionModel];
|
|
1954
1947
|
}
|
|
1955
1948
|
});
|
|
@@ -1992,22 +1985,22 @@ function loadFocusModel(url) {
|
|
|
1992
1985
|
return [4 /*yield*/, tf__namespace.loadLayersModel(url)];
|
|
1993
1986
|
case 1:
|
|
1994
1987
|
focusModel = _e.sent();
|
|
1995
|
-
return [4 /*yield*/, tf__namespace.ready()
|
|
1988
|
+
return [4 /*yield*/, tf__namespace.ready()
|
|
1989
|
+
// warm the model by predicting on an empty image...
|
|
1990
|
+
];
|
|
1996
1991
|
case 2:
|
|
1997
1992
|
_e.sent();
|
|
1998
|
-
_e.label = 3;
|
|
1999
|
-
case 3:
|
|
2000
|
-
_e.trys.push([3,, 6, 7]);
|
|
2001
|
-
tf__namespace.engine().startScope();
|
|
2002
1993
|
zeroes = tf__namespace.zeros([448, 448, 3]);
|
|
2003
1994
|
tfInt32 = tf__namespace.cast(zeroes, 'float32');
|
|
2004
1995
|
_b = (_a = tf__namespace).tensor4d;
|
|
2005
1996
|
_d = (_c = Array).from;
|
|
2006
1997
|
return [4 /*yield*/, tfInt32.data()];
|
|
2007
|
-
case
|
|
1998
|
+
case 3:
|
|
2008
1999
|
tf4d_ = _b.apply(_a, [_d.apply(_c, [_e.sent()]), [1, 448, 448, 3]]);
|
|
2009
2000
|
tf4d = tf__namespace.cast(tf4d_, 'float32');
|
|
2010
|
-
|
|
2001
|
+
return [4 /*yield*/, focusModel.predict(tf4d)];
|
|
2002
|
+
case 4:
|
|
2003
|
+
warmupResult = _e.sent();
|
|
2011
2004
|
return [4 /*yield*/, warmupResult.data()];
|
|
2012
2005
|
case 5:
|
|
2013
2006
|
_e.sent();
|
|
@@ -2016,11 +2009,6 @@ function loadFocusModel(url) {
|
|
|
2016
2009
|
tf4d.dispose();
|
|
2017
2010
|
tf4d_.dispose();
|
|
2018
2011
|
tf__namespace.dispose(zeroes);
|
|
2019
|
-
return [3 /*break*/, 7];
|
|
2020
|
-
case 6:
|
|
2021
|
-
tf__namespace.engine().endScope();
|
|
2022
|
-
return [7 /*endfinally*/];
|
|
2023
|
-
case 7:
|
|
2024
2012
|
return [2 /*return*/, focusModel];
|
|
2025
2013
|
}
|
|
2026
2014
|
});
|
|
@@ -9044,30 +9032,26 @@ function makeDocumentDetectionPredictions(image, logPredictions) {
|
|
|
9044
9032
|
_e.label = 1;
|
|
9045
9033
|
case 1:
|
|
9046
9034
|
_e.trys.push([1, 7, 8, 9]);
|
|
9035
|
+
console.log(' Tensors before:', tf__namespace.memory().numTensors);
|
|
9047
9036
|
tf__namespace.engine().startScope();
|
|
9048
9037
|
tfImg = tf__namespace.browser.fromPixels(image);
|
|
9049
9038
|
if (logPredictions) console.time('resize');
|
|
9050
9039
|
tfResize = tf__namespace.image.resizeBilinear(tfImg, [448, 448]);
|
|
9051
9040
|
if (logPredictions) console.timeEnd('resize');
|
|
9052
|
-
tfImg.dispose();
|
|
9053
9041
|
if (logPredictions) console.time('convert to int32');
|
|
9054
9042
|
tfInt32 = tf__namespace.cast(tfResize, 'int32');
|
|
9055
|
-
tfResize.dispose();
|
|
9056
9043
|
_b = (_a = tf__namespace).tensor4d;
|
|
9057
9044
|
_d = (_c = Array).from;
|
|
9058
9045
|
return [4 /*yield*/, tfInt32.data()];
|
|
9059
9046
|
case 2:
|
|
9060
9047
|
tf4d_ = _b.apply(_a, [_d.apply(_c, [_e.sent()]), [1, 448, 448, 3]]);
|
|
9061
|
-
tfInt32.dispose();
|
|
9062
9048
|
tf4d = tf__namespace.cast(tf4d_, 'int32');
|
|
9063
9049
|
if (logPredictions) console.timeEnd('convert to int32');
|
|
9064
|
-
tf4d_.dispose();
|
|
9065
9050
|
if (logPredictions) console.time('predictions');
|
|
9066
9051
|
return [4 /*yield*/, documentDetectionModel.executeAsync(tf4d)];
|
|
9067
9052
|
case 3:
|
|
9068
9053
|
result = _e.sent();
|
|
9069
9054
|
if (logPredictions) console.timeEnd('predictions');
|
|
9070
|
-
tf4d.dispose();
|
|
9071
9055
|
predictions = result;
|
|
9072
9056
|
if (logPredictions) {
|
|
9073
9057
|
console.log('predictions made!', predictions.map(function (r) {
|
|
@@ -9086,7 +9070,6 @@ function makeDocumentDetectionPredictions(image, logPredictions) {
|
|
|
9086
9070
|
labels = labels.map(function (l) {
|
|
9087
9071
|
return Math.round(l);
|
|
9088
9072
|
});
|
|
9089
|
-
tf__namespace.dispose(result);
|
|
9090
9073
|
time = new Date().getTime() - startedAt.getTime();
|
|
9091
9074
|
return [2 /*return*/, {
|
|
9092
9075
|
boxes: boxes,
|
|
@@ -9105,6 +9088,8 @@ function makeDocumentDetectionPredictions(image, logPredictions) {
|
|
|
9105
9088
|
}];
|
|
9106
9089
|
case 8:
|
|
9107
9090
|
tf__namespace.engine().endScope();
|
|
9091
|
+
// tf.engine().disposeVariables()
|
|
9092
|
+
console.log('Tensors afters:', tf__namespace.memory().numTensors);
|
|
9108
9093
|
return [7 /*endfinally*/];
|
|
9109
9094
|
case 9:
|
|
9110
9095
|
return [2 /*return*/];
|
|
@@ -9152,27 +9137,21 @@ function makeFocusPrediction(imageData, canvases, bbox, logPredictions) {
|
|
|
9152
9137
|
tfImg = tf__namespace.browser.fromPixels(imageData);
|
|
9153
9138
|
}
|
|
9154
9139
|
tfResize = tf__namespace.image.resizeBilinear(tfImg, [448, 448]).div(tf__namespace.scalar(127.5)).sub(tf__namespace.scalar(1));
|
|
9155
|
-
tfImg.dispose();
|
|
9156
9140
|
tfInt32 = tf__namespace.cast(tfResize, 'float32');
|
|
9157
|
-
tfResize.dispose();
|
|
9158
9141
|
_d = (_c = tf__namespace).tensor4d;
|
|
9159
9142
|
_f = (_e = Array).from;
|
|
9160
9143
|
return [4 /*yield*/, tfInt32.data()];
|
|
9161
9144
|
case 2:
|
|
9162
9145
|
tf4d_ = _d.apply(_c, [_f.apply(_e, [_g.sent()]), [1, 448, 448, 3]]);
|
|
9163
|
-
tfInt32.dispose();
|
|
9164
9146
|
tf4d = tf__namespace.cast(tf4d_, 'float32');
|
|
9165
|
-
tf4d_.dispose();
|
|
9166
9147
|
if (logPredictions) console.time('focus prediction');
|
|
9167
9148
|
return [4 /*yield*/, focusModel.predict(tf4d)];
|
|
9168
9149
|
case 3:
|
|
9169
9150
|
predictions = _g.sent();
|
|
9170
|
-
tf4d.dispose();
|
|
9171
9151
|
return [4 /*yield*/, predictions.array()];
|
|
9172
9152
|
case 4:
|
|
9173
9153
|
focusPrediction = _g.sent()[0];
|
|
9174
9154
|
if (logPredictions) console.timeEnd('focus prediction');
|
|
9175
|
-
tf__namespace.dispose(predictions);
|
|
9176
9155
|
predictionTime = new Date().getTime() - startedAt.getTime();
|
|
9177
9156
|
return [2 /*return*/, [focusPrediction, predictionTime]];
|
|
9178
9157
|
case 5:
|