idmission-web-sdk 1.0.193 → 1.0.195
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 +34 -42
- 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 +34 -42
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +34 -42
- 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.195';
|
|
52
52
|
|
|
53
53
|
function getPlatform() {
|
|
54
54
|
if (typeof window === 'undefined') return;
|
|
@@ -1910,31 +1910,30 @@ var CameraProvider = function CameraProvider(_a) {
|
|
|
1910
1910
|
var documentDetectionModel;
|
|
1911
1911
|
function loadDocumentDetectionModel(url) {
|
|
1912
1912
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1913
|
-
var zeroes, tfInt32, tf4d_, tf4d,
|
|
1914
|
-
return tslib.__generator(this, function (
|
|
1915
|
-
switch (
|
|
1913
|
+
var zeroes, tfInt32, tf4d_, tf4d, outputKeys;
|
|
1914
|
+
return tslib.__generator(this, function (_a) {
|
|
1915
|
+
switch (_a.label) {
|
|
1916
1916
|
case 0:
|
|
1917
1917
|
if (documentDetectionModel) return [2 /*return*/, documentDetectionModel];
|
|
1918
1918
|
return [4 /*yield*/, tf__namespace.loadGraphModel(url)];
|
|
1919
1919
|
case 1:
|
|
1920
|
-
documentDetectionModel =
|
|
1921
|
-
return [4 /*yield*/, tf__namespace.ready()
|
|
1922
|
-
// warm the model by predicting on an empty image
|
|
1923
|
-
];
|
|
1920
|
+
documentDetectionModel = _a.sent();
|
|
1921
|
+
return [4 /*yield*/, tf__namespace.ready()];
|
|
1924
1922
|
case 2:
|
|
1925
|
-
|
|
1923
|
+
_a.sent();
|
|
1924
|
+
_a.label = 3;
|
|
1925
|
+
case 3:
|
|
1926
|
+
_a.trys.push([3,, 5, 6]);
|
|
1927
|
+
tf__namespace.engine().startScope();
|
|
1926
1928
|
zeroes = tf__namespace.zeros([448, 448, 3]);
|
|
1927
1929
|
tfInt32 = tf__namespace.cast(zeroes, 'int32');
|
|
1928
1930
|
tf4d_ = tf__namespace.tensor4d(Array.from(tfInt32.dataSync()), [1, 448, 448, 3]);
|
|
1929
1931
|
tf4d = tf__namespace.cast(tf4d_, 'int32');
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
tf4d.dispose();
|
|
1936
|
-
tf4d_.dispose();
|
|
1937
|
-
tf__namespace.dispose(zeroes);
|
|
1932
|
+
return [4 /*yield*/, documentDetectionModel.executeAsync(tf4d)
|
|
1933
|
+
// interrogate the model to determine the output positions
|
|
1934
|
+
];
|
|
1935
|
+
case 4:
|
|
1936
|
+
_a.sent();
|
|
1938
1937
|
outputKeys = documentDetectionModel.outputs.map(function (o) {
|
|
1939
1938
|
return o.name;
|
|
1940
1939
|
});
|
|
@@ -1943,6 +1942,11 @@ function loadDocumentDetectionModel(url) {
|
|
|
1943
1942
|
scores: outputKeys.indexOf('Identity_4'),
|
|
1944
1943
|
labels: outputKeys.indexOf('Identity_2')
|
|
1945
1944
|
};
|
|
1945
|
+
return [3 /*break*/, 6];
|
|
1946
|
+
case 5:
|
|
1947
|
+
tf__namespace.engine().endScope();
|
|
1948
|
+
return [7 /*endfinally*/];
|
|
1949
|
+
case 6:
|
|
1946
1950
|
return [2 /*return*/, documentDetectionModel];
|
|
1947
1951
|
}
|
|
1948
1952
|
});
|
|
@@ -1985,30 +1989,31 @@ function loadFocusModel(url) {
|
|
|
1985
1989
|
return [4 /*yield*/, tf__namespace.loadLayersModel(url)];
|
|
1986
1990
|
case 1:
|
|
1987
1991
|
focusModel = _e.sent();
|
|
1988
|
-
return [4 /*yield*/, tf__namespace.ready()
|
|
1989
|
-
// warm the model by predicting on an empty image...
|
|
1990
|
-
];
|
|
1992
|
+
return [4 /*yield*/, tf__namespace.ready()];
|
|
1991
1993
|
case 2:
|
|
1992
1994
|
_e.sent();
|
|
1995
|
+
_e.label = 3;
|
|
1996
|
+
case 3:
|
|
1997
|
+
_e.trys.push([3,, 6, 7]);
|
|
1998
|
+
tf__namespace.engine().startScope();
|
|
1993
1999
|
zeroes = tf__namespace.zeros([448, 448, 3]);
|
|
1994
2000
|
tfInt32 = tf__namespace.cast(zeroes, 'float32');
|
|
1995
2001
|
_b = (_a = tf__namespace).tensor4d;
|
|
1996
2002
|
_d = (_c = Array).from;
|
|
1997
2003
|
return [4 /*yield*/, tfInt32.data()];
|
|
1998
|
-
case
|
|
2004
|
+
case 4:
|
|
1999
2005
|
tf4d_ = _b.apply(_a, [_d.apply(_c, [_e.sent()]), [1, 448, 448, 3]]);
|
|
2000
2006
|
tf4d = tf__namespace.cast(tf4d_, 'float32');
|
|
2001
|
-
|
|
2002
|
-
case 4:
|
|
2003
|
-
warmupResult = _e.sent();
|
|
2007
|
+
warmupResult = focusModel.predict(tf4d);
|
|
2004
2008
|
return [4 /*yield*/, warmupResult.data()];
|
|
2005
2009
|
case 5:
|
|
2006
2010
|
_e.sent();
|
|
2007
2011
|
tf__namespace.dispose(warmupResult);
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
+
return [3 /*break*/, 7];
|
|
2013
|
+
case 6:
|
|
2014
|
+
tf__namespace.engine().endScope();
|
|
2015
|
+
return [7 /*endfinally*/];
|
|
2016
|
+
case 7:
|
|
2012
2017
|
return [2 /*return*/, focusModel];
|
|
2013
2018
|
}
|
|
2014
2019
|
});
|
|
@@ -9038,25 +9043,20 @@ function makeDocumentDetectionPredictions(image, logPredictions) {
|
|
|
9038
9043
|
if (logPredictions) console.time('resize');
|
|
9039
9044
|
tfResize = tf__namespace.image.resizeBilinear(tfImg, [448, 448]);
|
|
9040
9045
|
if (logPredictions) console.timeEnd('resize');
|
|
9041
|
-
tfImg.dispose();
|
|
9042
9046
|
if (logPredictions) console.time('convert to int32');
|
|
9043
9047
|
tfInt32 = tf__namespace.cast(tfResize, 'int32');
|
|
9044
|
-
tfResize.dispose();
|
|
9045
9048
|
_b = (_a = tf__namespace).tensor4d;
|
|
9046
9049
|
_d = (_c = Array).from;
|
|
9047
9050
|
return [4 /*yield*/, tfInt32.data()];
|
|
9048
9051
|
case 2:
|
|
9049
9052
|
tf4d_ = _b.apply(_a, [_d.apply(_c, [_e.sent()]), [1, 448, 448, 3]]);
|
|
9050
|
-
tfInt32.dispose();
|
|
9051
9053
|
tf4d = tf__namespace.cast(tf4d_, 'int32');
|
|
9052
9054
|
if (logPredictions) console.timeEnd('convert to int32');
|
|
9053
|
-
tf4d_.dispose();
|
|
9054
9055
|
if (logPredictions) console.time('predictions');
|
|
9055
9056
|
return [4 /*yield*/, documentDetectionModel.executeAsync(tf4d)];
|
|
9056
9057
|
case 3:
|
|
9057
9058
|
result = _e.sent();
|
|
9058
9059
|
if (logPredictions) console.timeEnd('predictions');
|
|
9059
|
-
tf4d.dispose();
|
|
9060
9060
|
predictions = result;
|
|
9061
9061
|
if (logPredictions) {
|
|
9062
9062
|
console.log('predictions made!', predictions.map(function (r) {
|
|
@@ -9075,7 +9075,6 @@ function makeDocumentDetectionPredictions(image, logPredictions) {
|
|
|
9075
9075
|
labels = labels.map(function (l) {
|
|
9076
9076
|
return Math.round(l);
|
|
9077
9077
|
});
|
|
9078
|
-
tf__namespace.dispose(result);
|
|
9079
9078
|
time = new Date().getTime() - startedAt.getTime();
|
|
9080
9079
|
return [2 /*return*/, {
|
|
9081
9080
|
boxes: boxes,
|
|
@@ -9094,7 +9093,7 @@ function makeDocumentDetectionPredictions(image, logPredictions) {
|
|
|
9094
9093
|
}];
|
|
9095
9094
|
case 8:
|
|
9096
9095
|
tf__namespace.engine().endScope();
|
|
9097
|
-
|
|
9096
|
+
// tf.engine().disposeVariables()
|
|
9098
9097
|
console.log('Tensors afters:', tf__namespace.memory().numTensors);
|
|
9099
9098
|
return [7 /*endfinally*/];
|
|
9100
9099
|
case 9:
|
|
@@ -9143,27 +9142,21 @@ function makeFocusPrediction(imageData, canvases, bbox, logPredictions) {
|
|
|
9143
9142
|
tfImg = tf__namespace.browser.fromPixels(imageData);
|
|
9144
9143
|
}
|
|
9145
9144
|
tfResize = tf__namespace.image.resizeBilinear(tfImg, [448, 448]).div(tf__namespace.scalar(127.5)).sub(tf__namespace.scalar(1));
|
|
9146
|
-
tfImg.dispose();
|
|
9147
9145
|
tfInt32 = tf__namespace.cast(tfResize, 'float32');
|
|
9148
|
-
tfResize.dispose();
|
|
9149
9146
|
_d = (_c = tf__namespace).tensor4d;
|
|
9150
9147
|
_f = (_e = Array).from;
|
|
9151
9148
|
return [4 /*yield*/, tfInt32.data()];
|
|
9152
9149
|
case 2:
|
|
9153
9150
|
tf4d_ = _d.apply(_c, [_f.apply(_e, [_g.sent()]), [1, 448, 448, 3]]);
|
|
9154
|
-
tfInt32.dispose();
|
|
9155
9151
|
tf4d = tf__namespace.cast(tf4d_, 'float32');
|
|
9156
|
-
tf4d_.dispose();
|
|
9157
9152
|
if (logPredictions) console.time('focus prediction');
|
|
9158
9153
|
return [4 /*yield*/, focusModel.predict(tf4d)];
|
|
9159
9154
|
case 3:
|
|
9160
9155
|
predictions = _g.sent();
|
|
9161
|
-
tf4d.dispose();
|
|
9162
9156
|
return [4 /*yield*/, predictions.array()];
|
|
9163
9157
|
case 4:
|
|
9164
9158
|
focusPrediction = _g.sent()[0];
|
|
9165
9159
|
if (logPredictions) console.timeEnd('focus prediction');
|
|
9166
|
-
tf__namespace.dispose(predictions);
|
|
9167
9160
|
predictionTime = new Date().getTime() - startedAt.getTime();
|
|
9168
9161
|
return [2 /*return*/, [focusPrediction, predictionTime]];
|
|
9169
9162
|
case 5:
|
|
@@ -9171,7 +9164,6 @@ function makeFocusPrediction(imageData, canvases, bbox, logPredictions) {
|
|
|
9171
9164
|
return [2 /*return*/, [[0, 0], 0]];
|
|
9172
9165
|
case 6:
|
|
9173
9166
|
tf__namespace.engine().endScope();
|
|
9174
|
-
tf__namespace.engine().disposeVariables();
|
|
9175
9167
|
return [7 /*endfinally*/];
|
|
9176
9168
|
case 7:
|
|
9177
9169
|
return [2 /*return*/];
|